JavaScript is indeed a pretty neat language:
JavaScript is a lovable language. Real closures, first class functions, incredibly dynamic behavior…it’s a joy when you know it well.
Less experienced JS programmers often feel as though they’re waltzing in a minefield, though. At many steps along the path to JS enlightenment everything feels like it’s breaking down around you. The lack of block lexical scope sends you on pointless errands, the various OO patterns give you fits as you try to do anything but what’s in the examples, and before you know it even the trusty “dot” operator starts looking suspect. What do you mean that this doesn’t point to the object I got the function from?
Repairs for some of the others are on the way in ES6 so I want to focus on the badly botched situation regarding “promiscuous this“, in particular how ES5 has done us few favors and why we’re slated to continue the cavalcade of failure should parts of the language sprout auto-binding.
Posted on: 2010 Sep 14