JavaScript: The Good Parts: The Good Parts
Rate it:
Open Preview
8%
Flag icon
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.
13%
Flag icon
Attempting to retrieve values from undefined will throw a TypeError exception. This can be guarded against with the && operator:
Felipe Calloni
e.g. flight.equipment && flight.equipment.model Crockford, Douglas. JavaScript: The Good Parts (Kindle Location 449). O'Reilly Media. Kindle Edition.
16%
Flag icon
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.
16%
Flag icon
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. The patterns differ in how the bonus parameter this is initialized.
24%
Flag icon
Avoid creating functions within a loop. It can be wasteful computationally,and it can cause confusion,