#8 Globals are still a bad idea - Lessons Learned While Reading "Effective Javascript"

One of the first things you notice with JS is just how easy it is to pollute the global namespace. Obviously, you should avoid doing that. One little detail worth keeping in mind: Global variables are automatically attached to the global object and can be updated as such.

#6 Semicolons - Lessons Learned While Reading "Effective Javascript"

In Javascript, semicolons are optional. However, for the sake of simplicity, it's best to include them. Furthermore, when always including semicolons, it's important to remember that the following statements may not have a newline before their arguments: (JS will implicitely insert a semicolon)

  • ++
  • --
  • break
  • continue
  • return
  • throw

#5 Operator Equals - Lessons Learned While Reading "Effective Javascript"

In Javascript you have two equals operators: implicit coercion equals operator (==) and strict equality operator (===). The former will try to coerce different types and attempt equality checks, while the latter will only operate without any conversions.

Because of these properties, the "===" operator is prefered, as it's explicit nature yields less potentially tricky (buggy) code due to non-obvious conversions. (and helps with code readability)