The State of JavaScript: Language Versions

The State of JavaScript: Language Versions

JavaScript is the indisputable language of the Web, and there is an excellent possibility that 2015 will see the release of ECMAScript 6, the standardized version of JavaScript

JavaScript is the indisputable language of the Web, and there is an excellent possibility that 2015 will see the release of ECMAScript 6, the standardized version of JavaScript. In my last column about JavaScript, I took a quick look at the history of this much-maligned but widely used scripting language. I’ll continue that discussion with a look at how ECMAScript has evolved, and a bit about how the standardized version relates to the JavaScript language as maintained by Mozilla.

In the early days of the Web, as the browser wars between Netscape and Microsoft heated up, Netscape looked to standards bodies to prevent Microsoft’s embrace and extend strategy that often succeeded in killing off competing technologies. Ecma International, formerly the European Computer Manufacturers Association (ECMA), agreed to take on JavaScript as a standard. Because of Sun’s ownership of the JavaScript name, ECMA had to use a different name. After unsuccessfully trying to get the standards committee to agree to a new name, they adopted its working name, ECMAScript. As a result, ECMAScript is the official name of the standard form of the language—alas—but virtually everyone uses the JavaScript name.

Table 1 lists the releases of ECMAScript to date as of this writing, along with the major theme of the changes in each version. (I compiled the table from the ECMAScript Wikipedia page and other sources.) Development on the language is ongoing, and because of its wide use there continues to be a lot of interest in its future directions.

Version

Release Date

Major Changes

1

June 1997

Initial release.

2

June 1998

Primarily editorial changes to keep the specification aligned with the ISO/IEC 16262 international standard for ECMAScript.

3

December 1999

Added support for regular expressions, improved string handling, new control statements, exception handling, and various numeric output formatting, and more.

4

--

Abandoned due to political differences and technical difficulties with the complexity of the language. Some features developed made it into version 5, others deferred for future versions.

5

December 2009

Adds Strict mode, clarifies ambiguities, and implemented accommodations for real-world uses of implementations. Adds getters and setters, support for JSON, and reflection on object properties.

5.1

June 2011

Release to align with the third edition of the international standard ISO/IEC 16262:2011.

6

Projected Mid 2015

Significant new syntax for building complex applications, including long-awaited direct language support for classes and modules, as well as numerous other language enhancements.

Table 1. ECMAScript releases and summary of enhancements.

As recently as 2012, all modern Web browsers use ECMAScript 3. ECMA released ECMAScript 5 late in 2009, which so far is achieving relatively slow adoption in new browser versions, although the pace of implementation has accelerated as ECMAScript 6 nears.

ECMAScript defines two versions of language: default and strict. The default version of the language is compatible with earlier versions of ECMAScript, while the optional strict mode is a smaller language that deletes some of the worst parts of the language. For the most part, strict mode avoids most of the warts of the language and looks to the future when ECMAScript is much more robust and refined. In the meantime, the default version of the language is highly compatible with earlier versions, warts and all.

If you are writing for browsers that support ECMAScript 5, you can use strict mode by including a “use strict” statement at the top of your block of JavaScript code, before any other statements, like the following. You can apply this statement to entire scripts or just to individual functions. 

<script>
     "use strict";
     ... rest of JavaScript code
</script>

Which Version Should You Use?

This discussion begs the question of which version of the language you should target today: ECMAScript 3, ECMAScript 5/Default, or ECMAScript 5/Strict. To some extent, your choice is constrained by the browsers you have to support. As long as the browser versions were released no earlier than the early part of this millennium—the early 2000s—you should be safe using ECMAScript 3. As new browser versions are released that adopt ECMAScript 5, use the strict mode of ECMAScript 5, since it is the safest choice with language features that are largely well-designed, reliable, and help you write error-free code.

In the meantime, I like the advice of Douglas Crockford, “the JavaScript guy,” who is Yahoo!’s chief JavaScript architect and a member of the ECMAScript standards committee. He recommends that in the short term you stick to the intersection—the common elements of—ECMAScript 3 and 5/Strict. In the long term, use only ECMAScript 5/Strict as browsers start to widely adopt it. Don’t use ECMAScript 5/Default; that’s not where the future lies.

Language Versions

With the development of the JavaScript language proceeding on so many fronts—primarily the standardization committee, Microsoft, and Mozilla, among others—it can be confusing to really know what version corresponds to what is available in each browser and in other applications. Table 2, which I also adapted from a table in the JavaScript topic on Wikipedia as well as other sources, attempts to sort everything out based on JavaScript language development at Netscape and then Mozilla. It shows the JavaScript and corresponding ECMAScript versions, as well as which versions of the major browsers implement each version of the language. The JavaScript Version in the first column is Mozilla’s version number.

JavaScript Version

Version Released

Equivalent to

Netscape Navigator

Mozilla Firefox

Internet Explorer

Google Chrome

1.0

March 1996

 

2.0

 

3.0

 

1.1

August 1996

 

3.0

 

 

 

1.2

June 1997

 

4.0-4.05

 

 

 

1.3

October 1998

ECMAScript 1 & 2

4.06-4.7x

 

4.0

 

1.5

November 2000

ECMAScript 3

6.0

1.0

5.5-8.0

1.0-10.0.666

1.6

November 2005

ECMAScript for XML

 

1.5

 

 

1.7

October 2006

 

 

2.0

 

 

1.8

June 2008

 

 

3.0

 

 

1.8.1

June 2009

 

 

3.5

 

 

1.8.2

January 2010

 

 

3.6

 

 

1.8.5

March 2011

ECMAScript 5

 

4

9, 10

13.0+

Table 2. JavaScript and browser versions.

JavaScript version 1.4 is not listed in the table because it was a release designed to work only on the Netscape Web server and was not intended for use in any browser. That version of JavaScript was compatible with ECMAScript 1.

As you can see in the table, Netscape and Mozilla have driven much of the development over the years. One note of caution, however: I assembled the table from various sources of what I believe to be reliable information, but there is a lot of conflicting information and room for interpretation. Nevertheless, I believe the information here faithfully represents the development and implementation of JavaScript across the major browsers and their versions. And this is all a moving target, so check your browser’s specs for the latest, most up to date information.

The information in the table identifies that JavaScript version 1.5 and ECMAScript 3 are generally the lowest common denominator of language versions, and were the first versions included with the Opera and Safari browsers, which are not shown in the table. New versions of each browser are likely to inch forward with updates to the language, although implementation will probably always lag the benchmark set by Mozilla and the ECMAScript standard.

With this article, I conclude my look back at the history and current state of JavaScript. As I continue this series, I’ll start to explore the juicier new features coming in ECMAScript 6.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish