sprintf for JavaScript

Avoid writing formatting functions in JavaScript by grabbing yourself a decent sprintf implementation – handling padding, truncation, floating-point numbers, left/right alignment and re-ordered arguments. You can download sprintf for JavaScript, […]

Numbers in form-fields

JavaScript is often used for client-side form validation to save unnecessary round-trips to the server. Unfortunately, lots of client-side validation relies on lenient JavaScript methods such as parseInt, allowing numbers […]

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’.