JS Tip of the Day: JavaScript (ECMAScript) Versioning

JavaScript (ECMAScript) Versioning

The JavaScript language standard is defined by the ECMAScript specification. This is a standard maintained by the standards body Ecma International, with a name that is fittingly suggestive of that very fact. But this wasn’t always the case.

There was a time in history where there was no official standard and JavaScript was as Netscape decided it would be. In those days you saw JavaScript versions along the lines of 1.1 and 1.8 etc. You may even see old HTML with script tags that say something like <script language="JavaScript1.8" ...>, but that was never officially supported, and thankfully, not something you have to worry about today.

Once standardized through Emca, JavaScript’s versioning was instead defined by the release of the ECMAScript standard. As of this writing, there are officially 9 major released editions of ECMAScript, with the current being ECMAScript edition 10 (edition 4 was never released). At first, the versioning of these releases was represented by “ES” followed by the edition number. The first versions of ECMAScript were:

  • ES1
  • ES2
  • ES3
  • (ES4 never released)
  • ES5 (with an ES5.1)
  • ES6

ES6 was a major release with a lot of new additions to the language - the largest release there ever was, and probably the largest there ever will be. It was also with this release that additions to the language were becoming more common, following a yearly release cycle. The naming for these releases then changed to a format using “ES” followed by the year related to the release. Releases since have included:

  • ES2015 (ES6)
  • ES2016
  • ES2017
  • ES2018
  • ES2019
  • ES2020 (coming soon)

Tips in this list for ECMAScript-defined features will follow the date format seen above in identifying which version of the specification they’re from. This will serve as an indication to how new the feature is and how likely you’ll be able to use it in your browser.

Before Ecma, JavaScript releases were usually tied to browser releases, but that is no longer the case. In fact, as modern browsers release updates, they may choose to support only a portion of the features in the newest specification. Sometimes you may not exactly know if a feature is supported in a browser until you try. And its far more difficult to know what other users’ browsers support. By using features defined in older versions of the specification, the more likely other users will be able to use that feature in their browser. This is something you’ll need to keep in mind if you’re developing content for people other than yourself. A website for helping with this is caniuse.

Note that not everything you see and use in JavaScript is defined in the ECMAScript standard. This standard only defines the core language components and syntax. Other APIs, particularly those you see in the browser, are extensions to the language and specific to the browser environement. These include things like document.querySelector() and setTimeout(). When tips here cover these APIs, an ECMAScript version will not be included as it would not apply. Those are instead defined by the WHATWG “living standard” which has no real versioning (and as a result, tips covering those APIs will be without any mention of an associated version).

More info:

1 Like