Most programming languages contain good and bad parts, but JavaScript has more than its share of the bad, having been developed and released in a hurry before it could be refined. This authoritative book scrapes away these bad features to reveal a subset of JavaScript that's more reliable,... read more
“Generally, the craft of programming is the factoring of a set of requirements into a set of functions and data structures.”
There are four patterns of invocation in JavaScript: the method invocation pattern, the function invocation pattern, the constructor invocation pattern, and the apply invocation pattern.Highlighted by 140 Kindle customers
The || operator can be used to fill in default values:Highlighted by 108 Kindle customers
One way to minimize the use of global variables is to create a single global variable for your application: var MYAPP = {};Highlighted by 101 Kindle customers
it is best to declare all of the variables used in a function at the top of the function body.Highlighted by 96 Kindle customers
In addition to the declared parameters, every function receives two additional parameters: this and arguments.Highlighted by 90 Kindle customers
It is usually necessary to test object.hasOwnProperty(variable) to determine whether the property name is truly a member of the object or was found instead on the prototype chain.Highlighted by 86 Kindle customers
The function object created by a function literal contains a link to that outer context. This is called closure. This is the source of enormous expressive power.Highlighted by 82 Kindle customers
Every function object is also created with a prototype property. Its value is an object with a constructor property whose value is the function.Highlighted by 73 Kindle customers
The very good ideas include functions, loose typing, dynamic objects, and an expressive object literal notation. The bad ideas include a programming model based on global variables.Highlighted by 49 Kindle customers
Unlike many other languages, blocks in JavaScript do not create a new scope, so variables should be defined at the top of the function, not in blocks.Highlighted by 48 Kindle customers
We’re hiding the errata, movie connections, books that influenced this book, books influenced by this book, books that cite this book and books cited by this book sections. If you would like to add content to them, you must first make them visible.