ECMAScript 2018 Is Feature Complete
Written by Ian Elliot   
Monday, 05 February 2018

What's new in JavaScript/ES2018? Not much, but keep your eye on what is happening or it might just come as a surprise.


Although the new TC39 process, which pushes new JavaScript features through the approvals mill one at a time, makes the yearly release less important it still produces a bundle of changes that we can discuss. Yes it's ES2018 already.

So what is new?

Not a great deal, and this is a good, not bad, thing. JavaScript should be a mature language by now and after the huge changes in ES2015 we need some stability.

Probably the most important of the new features is Asynchronous iteration. Synchronous iteration, introduced in ES2015, lets you write:

var array=[1,2,3];
for(let value of array){

The new feature extends this to long running asynchronous operations using await:

for await(let value of getValueAsync(){

which doesn't block the UI thread while waiting for the asynchronous iterator. You can, of course, create your own asynchronous  iterables. The only problem is that the feature isn't widely supported as yet, but all of the JavaScript engines are being updated to include it.

The next biggest feature is probably the rest spread operator and you might be forgiven for thinking that this was already in JavaScript. The rest operator works in ES2015 on arrays and now in ES2018 on objects. If you destructure an object you can now add ... to signal that any remaining properties should be packed into the final variable. For example:

let {x,y,...z}={x:1,y:2,a:3,b:4};

stores 1 in x, 2 in y and {a:3,b:4} in z i.e. the rest of the object. Similarly the spread operator now works in objects:

let n = { x, y, ...z };

gets us back to our original object {x:1,y:2,a:3,b:4}

We also have some new features in regular expressions: named capture groups, unicode property escapes, lookbehind assertions and s(dotAll) flag. JavaScript has had numbered groups for a while, but now you can assign an id and use that id in a backreference etc. Unicode property escapes extend the classification of characters to unicode properties such as Greek characters,Currency_Symbol and so on. Lookbehind assertions are a generalization of lookahead assertions and are likely to make regular expressions even harder to understand!

Finally we have finally.

Well Promise.finally to be exact. As we reported on the release of Firefox 58, you can now use the Promise finally method to run code no matter how the Promise resolves.

What can we expect for ES2019?

Of the proposals close to being completed, the idea of adding 64-bit integers is likely to be the most useful. If you want to use JavaScript like a class-based language then you might also like public and private fields - just add a # to the front of a property name and it becomes private. It may be backward compatible, but it introduces the sigil into JavaScript and should be resisted for this reason alone.



More Information

Related Articles

Firefox 58 - Tab Throttling, WebAssembly, Promise Finally And Progressive Web Apps

ECMAScript 2016 Approved

JavaScript The Language With Two Names    

The JavaScript Encyclopedia Work In Progress 

JavaScript Added To Oxford English Dictionary 

JavaScript 6 EcmaScript 2015 Final Approval 

JavaScript 20 Years Old Today 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.



OpenAI Enriched By Stack Overflow

Stack Overflow has announced a partnership with OpenAI that could improve the accuracy of ChatGPT with regard to programming knowledge. This sounds promising, but there are potential problems.

Microsoft's Cybersecurity For Beginners

A free, self-paced course about Cybersecurity 101 is on offer by Microsoft's Cloud Security Advocates. It's a 30+ lesson curriculum targeted at complete novices.

More News

raspberry pi books



or email your comment to:


Last Updated ( Friday, 15 June 2018 )