BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News TC39 Finalizes Feature Set for ECMAScript 2018

TC39 Finalizes Feature Set for ECMAScript 2018

Leia em Português

This item in japanese

Bookmarks

TC39 finalized the feature set for ES2018, the latest revision to the ECMAScript Language Specification, in their 23-25 January meeting. This update adds new features like asynchronous iterators and rest/spread operators for object destructuring and object literals, substantial updates to regular expressions, and additional updates to promises and template literals.

The newly finalized Asynchronous Iteration functionality provides native support within JavaScript for iterating over data that is fetched asynchronously, such as from a file read in Node.js or a WebSocket in the browser. Along with extending existing generator and looping functionality, the feature introduces two new keywords into the language, async and await. In a post on Hackernoon, Mostafa Gaafar explains the value of the new syntax:

Async/await is one of the most revolutionary features that has been added to JavaScript in the past few years. It makes you realize what a syntactical mess promises are, and provides an intuitive replacement.

Asynchronous Iteration is transpilable by Babel, and available natively in Node.js since version 7.6, as well as Chrome, Firefox, and Safari Technology Preview.

The new specification also adds support for spread/rest syntax on object literals, generalizing a syntax that has been supported in arrays since ES2015. In a walkthrough on the Google developer blog, Mathias Bynens explains that "Spread properties offer a more elegant alternative to Object.assign() in many situations". This functionality is also transpilable by Babel, with native support in Node since version 8.6, as well as Chrome, Firefox, and Safari Technology Preview.

The largest updates to existing functionality in the new specification are the updates to RegExp. ECMAScript 2018 adds a number of features to regular expressions that have been present in other languages but lacking in JavaScript. These features include 'Dotall mode', lookbehind assertions, named capture groups, and unicode property escapes.

A final update in the 2018 specification is to revise the functionality of template literals, allowing some sequences of characters that previously were illegal. For a definitive reference on the proposals that have been finalized, developers can check out TC39’s list of finalized proposals, or follow along the process of all active proposals in front of TC39.

Rate this Article

Adoption
Style

BT