12 JavaScript quirks

[2013-04-08] dev, twelvequirks, javascript, jslang
(Ad, please don’t block)
A core of JavaScript (the so-called “good parts”) is elegant, but that core is often obscured by quirks. This introduction is the first of a series of blog posts that looks at twelve common quirks and how to best deal with them:
  1. Implicit conversion of values
  2. Two “non-values” – undefined and null
  3. Normal equality (==)
  4. Unknown variable names create global variables
  5. Parameter handling
  6. The scope of variables
  7. Inadvertent sharing of variables via closures
  8. Array-like objects
  9. Subtyping constructors
  10. Reading and writing of properties
  11. this in real functions
  12. The for-in loop
A concluding post will cover ECMAScript 6 [1], which will eliminate most of the above quirks.

The series will provide a good overview of JavaScript. It is a translation of a previous blog post in German. ECMAScript 5 will be used and a basic knowledge of JavaScript is required, but much will be explained. I will post one quirk per week.

Reference:

  1. ECMAScript: ES.next versus ES 6 versus ES Harmony