day 119 — code 365

Sat 09 Apr 2016

Working through the example To Do app in Addy Osmani’s book on Backbone. An. Intense. Experience.

And (one of many things I took ages to understand) this line came up:

var app = app || {};

So… the first file with var app = app || {}; will create the

app variable as an empty object ({}) (and use the second option) … but subsequent files with that line will simply inherit the stuff made inside that object (and use the first option)?

This is such an incredible book — so well structured — very detailed and dense (though!). Highly recommended.

Thanks for stopping by!