Kindle Notes & Highlights
For example, it’s easier to say (and think) “immediate function,” than “this thing where you wrap the function in parentheses and at the end of it put another set of parentheses to invoke the function right where you’ve defined it.”
Access to the Global Object
Single var Pattern
Hoisting: A Problem with Scattered vars
for Loops
switch Pattern
Avoiding Implied Typecasting
In this chapter we looked at what it means to write maintainable code — a topic that is important not only for the success of a software project but also to the sanity and well-being of the developers and those around them. Then we talked about some of the essential best practices and patterns including: Reducing the number of globals, ideally to one per application Using a single var per function, which helps keep an eye on all variables in a single spot and prevents surprises caused by the variable hoisting behavior for loops, for-in loops, switches, “eval() is evil,” not augmenting built-in
...more
We’ll talk more about prototypes and inheritance in the chapters to come, but just remember that reusable members, such as methods, should go to the prototype.

