The JavaScript Taboo: Extending Built-In Objects

It is common knowledge that modifying the prototype of built-in JavaScript objects (Array, String, HTMLElement, etc.) is a bad idea.

Prototype.js, one of the first popular JavaScript frameworks of the AJAX era, made heavy use of extending the DOM, but then came jQuery and pretty much killed it, because it wrapped everything in $() instead of extending prototypes, which is safer in terms of compatibility with other libraries and browser updates.

DOM extension is one of the biggest mistakes Prototype.js has ever done.

Continue reading →

The Perils of Function Scoping

As you probably know, block-scoping using let is being introduced in the ECMAScript 6 standard. But why is this even neccesary? A lot of people seem confused about this.

Should we go ahead and replace every occurence of var with let now?

Let's analyze the situation.

Continue reading →