So What Is ECMAScript Then?
Where Does the ECMA–262 Specification Come From?
The Ecma International Technical Committee 39 (aka TC39) is a committee of very smart people, which is associated with a group of participants that are also very smart. They get together for committee meetings approximately every two months that are driven by pre-defined agendas.
TC39 is tasked with maintaining and updating the aforementioned ECMAScript specification via a consensual process. This includes the language syntax, semantics, and libraries and complementary technologies that support the language.
This all happens via a process defined by TC39. It all starts with a feature sketch that’s made for an ECMAScript specification enhancement or modification, which often comes from developer community suggestions, or TC39 participants themselves. If deemed worthy to pursue by the committee, the sketch is promoted to an official proposal and one or more “champions” are assigned to it.
Current ECMAScript Compatibility
ECMAScript 6 (aka ES.Next) is on its way to becoming mainstream and widely used. Recall that the current version of ECMAScript is 5.1, with so-called “Harmony” encompassing the upcoming 6 and 7 versions.
While many Harmony features are already implemented in modern browsers, and in Node.js using the “harmony” flag, there are still other features that require a compiler/transpiler to use (discussed shortly).
Juriy “kangax” Zaytsev, author of the Perfection Kills blog, has created and maintains an excellent set of ECMAScript compatibility tables. These tables are organized by ECMAScript feature and indicate compatibility of that feature for a given ECMAScript compiler, desktop browser (vendor and version), server framework (e.g., Rhino, PhantomJS, Node.js), and iOS mobile operating system.
In addition to these tables, MDN often provides feature compatibility tables for desktop and mobile browsers.
Can I Use Upcoming ECMAScript Features Now?
Yes you can. Some of these features are already implemented in certain browsers and Node, but many require the use of a third-party ECMAScript transpiler. These transpiler’s are sometimes also referred to as a compiler. Technically there is a difference between a transpiler and a traditional compiler.
Regarding ECMAScript transpilers, the input language is an upcoming version of the language specification (e.g., EC 6), which is then compiled to a prior, more stable and widely compatible version of the same specification (e.g., EC 5.1). For the remainder of this article we will simply refer to them as transpilers.
There are plenty of resources online about writing Harmony code today, and specific transpilers, including what they can be used for. Refer to the list at the end of this article for some resources worth checking out.
Should I Use Upcoming ECMAScript Features Now?
The answer really depends on if you’re talking about learning and playing around with upcoming language features, or actually employing a transpiler and/or these features in production.
The more mature and advanced in the process the feature is, the more likely it is to remain the same in the final published specification. Many of these features however (EC7, strawman, etc.), are still in early stages of the process and may be changed or removed from the final specification. In these cases, it may not be a good idea to use features that may not be in the final specification, or are subject to major changes before publication.
In the former case, I think it’s a great idea to use a transpiler to get ahead of the game. People often talk about keeping their skills up to date on the latest technologies, and for good reason given how fast these things change. Learning upcoming ECMAScript features takes this to a whole new level, in that you’re not learning something retroactively and reactively, but before it’s officially released. This is a much more proactive approach to professional development, and opportunities like this are few and far between.