Users stumbling across jQuery may notice the API’s designed so a method’s behaviour varies depending on the number and type of arguments passed in a call (have a look at […]
apply. In this post I present my own implementation with plenty of notes to highlight and explain the hidden complexity.
This is a quick tip for iterating over arrays and other objects with a
length property. It’s particularly suitable for sparse arrays, without having to worry whether any methods have been added to the prototype chain.
pop methods to provide support for older browsers. With no exaggeration, every implementation is flawed. While this is quite damming, I’ve discovered something worse: not one browser implements push and pop correctly. Each browser has its own bugs: Internet Explorer’s methods can’t be reused; Safari has type-conversion issues; Firefox & Opera don’t truncate Arrays properly.
Seven years after the publication of the ECMAScript Language Specification, shouldn’t we expect a little more? In this article, I’ll document the current problems, and show how to write implementations that conform precisely to the language spec’.