Javascript for Modern Browsers

The knock on effects of the demise of XP


The sunset of official support for Windows XP on the 8th of April this year is fast approaching, and with it the side-effect that when users upgrade to modern versions of Microsoft’s operating system, they will finally have a default browser installed which is not obsolete.


Despite the fact that most (if not all) other browsers aside from Internet Explorer have had support for many new features for years—this article specifically targets their Javascript implementation—web developers have not been able to roll them out across projects where wide browser support was required.

This should be about to change now, and there are some exciting language features which developers can make use of. The most interesting effect may be that abstraction/compatibility libraries such as jQuery may no longer be necessary or even recommended given their new weight/benefit ratio.

ECMAScript 5 can finally make a difference

It turns out, that while the front end world has been stuck building sites compatible with extremely old in tech terms versions of Internet Explorer, the main browser vendors and ECMA standards body have not been standing idle. A great number of additions have been added to Javascript which fill gaps that have been frustrating for years, and also optimise the way code can be written with more intuitive patterns.

Those who have been using Node.js of course have been able to use these features for a while, but it is great that they may finally be phased into browser based projects, bringing to the front end and back end closer together.

This article highlights a few of the features which developers can begin to start using, browser support permitting.

Top 5 features

Object.create
Possibly one of the most confusing aspects of Javascript development is the concept of prototypal inheritance. Object.create tidies things up, and provides a sane constructor chaining mechanism. If you’re doing a lot of prototypal inheritance, or making use of libraries to make this easier for you, I’d recommend reading up on this method.

Array.isArray
Javascript’s loose typed nature means that testing object type is quite common. Traditionally checking for arrays was long-winded involving typeof which could be unreliable, or instanceof with it’s somewhat strange syntax. This changes with Array.isArray(object) which will return true or false. Simple.

Array.prototype.forEach
Iterating through arrays has always been easier done with jQuery’s each helper method. This new method on arrays however does away with the need to use jQuery as it largely fulfils the same functionality, albeit with slightly different callback parameters.

Array.prototype.map
Yes—this is another array method, but manipulating arrays in browsers has always been a bit cumbersome. No more, with the map prototype method. This method simplifies array creation based on a function of another array.

Function.prototype.bind
This method is possibly the addition which could yield the greatest relief to developers. Scoping callback functions has traditionally been a big hassle, with developers resorting to closures or jQuery’s proxy helper to get around this issue. Setting this to the right scope is now extremely easy.

Bonus features

Date.now
Helper method which simplifies doing (new Date).valueOf()

Reserved words as property names
These have been a bit of an annoyance given they would cause errors when used as property names—it could make importing JSON from some systems a pain if not configured for compatibility. Happily, this issue is now gone.


As this year goes on, I predict the community will see support for Internet Explorer 8 dropping off slowly, accelerating into 2015. At the same time we should see adoption of the above features increase dramatically, and hopefully with it, more intuitive code being deployed across the web. In addition, the drastic improvements in standards support in Microsoft’s latest iterations of it’s ubiquitous browser will hopefully make endless waiting for widespread implementations of language updates a thing of the past.

Email me when Khaitu publishes or recommends stories