For those wondering how you get numbers, strings and other primitives from a whole bunch of empty arrays and objects in JavaScript, here's what happens when you do arithmetic and other operations on arrays and objects: > [] + [] "" (An empty string) > {} + [] 0 (The number zero) > [] + {} "[object Object]" (.toString() called on a plain object). > ![] false (!{} is the same) > !![] true (not false) > +[] 0 (the numbe…
Does knowing any of this make you a better programmer? I'd say no. Should you be using any of this in production code? No The next programmer even if he is a really good one might not know that particular esoteric trick. I'm not trying to vote down or anything, but what is the point? Most of it look like language design warts to me. Most of them should have thrown exceptions and errored out. Now I'm loving the idea o…
The bit at the end (integer and float casting) is almost essential knowledge now for anyone writing JavaScript code that does anything mildly intensive.