Array push and pop: a complete embarrassment for JavaScript

Most JavaScript libraries include trivial implementations of Array’s push and 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’.