Join the DZone community and get the full member experience.Join For Free
Six Major Releases of ECMA-262
Since then, there have been but five more major releases of ECMA-262.
Second edition. The second edition in June 1998 consisted of mostly editorial changes.
Third edition. The third edition came out in December 1999, adding features such as regular expressions and formats for numeric output.
Fourth edition. The fourth edition was abandoned due to differences of opinion on the complexity of the language.
Sixth edition. The sixth edition was approved by the summer of 2015. Commonly called ES6, the official name is ECMAScript 2015. Future releases will follow this format: “ECMAScript” followed by the release year. Hence, the next version will be ECMAScript 2016, and that pattern will continue.
The sixth edition adds essential syntax for creating complex applications. Other new components include binary data, generators and generator expressions similar to the Python language, error functions, proxies, for/or loops and collections.
The next edition is still at the beginning of its development. It is scheduled to include new features such as operator overloading, promises/concurrency, pattern matching, and more.
Limitations of ES6
Lack of 64-bit numeric type. Despite the continuing evolution of the language, some nagging technical problems remain. One sore spot is the continuing absence of 64-bit numeric type. Currently, it only supports doubles due to its support for floating-point operations.
7 Major ES6 Features
Despite these ongoing challenges, the new features inside ES6 are extensive and impressive. They include:
Modules. Modules allow you to reuse parts of your application in other areas. Using new import and export keywords, you can load dependencies and manage them. While you could cobble together similar functionality in ES5 using external libraries such as CommonJS, modularity is so important for today’s large programs, it is a significant benefit that it was built in as a core feature in ES6.
Promises. Errors arising from asynchronous operations can now be handled with promises. While you can handle the same situation with callbacks, promises are much more readable due to concise error handling and method chaining.
Arrows. This function shorthand uses the syntax =>. While not a monumental addition, this simple improvement provides lexical scoping of the keyword “this.”
Const. Const makes it easier to ensure your code is accurate. Const lets anyone scanning the code see any variables that should not be modified, and throws off an error if he or she is. This helps reduce bugs because values keep their meaning and prevent a team member from changing a variable inadvertently.
Property Names. In the previous version, ES5, you could not use a variable right in an object literal. ES6 allows this with specific syntax.
Template Literals. Allows changing variables into strings. Template strings show much promise as a useful feature, such as using a tag for auto-escaping SQL strings.
“Sugar Syntax”. As mentioned previously, ES6 has made a concerted effort to simplify the syntax. A new class syntax is “syntactic sugar” because it makes the language simpler and more readable. It does not change how the system works but provides a cleaner syntax for developers who prefer it.
Other features include:
Block Level Scoping. Using the "let" keyword, ES6 lets you scope variables directly to blocks.
Generators. Functions that make iterators utilizing "function*" and the keyword "yield."
Rest Parameters. Now you do not have to use arguments to access arguments for functions. You can access arrays that represent the remaining parameters.
Set. You can store a data values list inside a collection object.
Default Parameters. If you’ve ever wanted a function parameter that could be set default value, you are in luck, because ES6 has this functionality.
A Major Upgrade With Room To Grow
At the same time, ECMA needs to figure out a way for outside programmers to offer useful ideas and implement necessary features like 64-bit numeric type. If anything, ECMA needs to work faster. ES5 was adopted in 2009, and some industry watchers think it did not offer enough new features to be rolled out as a major upgrade. Indeed, some saw ES5 as nothing more than a warmed-over version of ES3. From that point of view, there haven’t been any significant advancements in the specification for many years.
Published at DZone with permission of Omed Habib , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.