Paul Krill
Editor at Large

What’s new in ECMAScript 2018

news
Jun 29, 20182 mins

The ECMAScript 23018 specification incudes new capabilities for asynchronous programming and regular expressions

JavaScript code
Credit: Iwan Gabovitch

ECMAScript, the standard specification underlying JavaScript, has a new specification, approved by the ECMA Interational standards body in late June 2018.

The ECMAScript 23018 specification incudes new capabilities for asynchronous programming and regular expressions.

The approved changes to the specficiation include:

  • Async iterators, adding syntactic support for asynchronous iteration using the AsyncIterable and AsyncIterator protocols. The feature makes it possible a for-wait-of iteration statement while adding syntax for creating async generator functions and methods.
  • Adding the s (dotAll) flag for regular expressions, providing consistent behavior for these expressions. The feature is intended to address limitations in which the dot (.) in regular expressions does not match line-terminator characters. The s flag changes that. This flag will operate on an opt-in basis, so existing regular expressions patterns will not be affected.
  • Regexp (regular expression) Unicode property escapes, giving developers a better way to access Unicode character properties. Property escapes in the form of p{…} and P{…} will be added.
  • Regexp look-behind assertions, fixing a shortcoming with lookarounds, which are zero-width assertions that match a string without consuming anything. With look-behind assertions, developers can ensure that a pattern is or is not preceded by another; for example, matching a dollar amount without capturing the dollar sign.
  • Rest/spread properties, providing a minor syntactic improvement.
  • prototype.finally(), for cleanup after finishing up with a resource.
  • Regexp named capture groups, to identify capture groups, making them easier to find and making the regular expression easier to understand. Previously, capture groups were accessed by numbers.
  • Template Literal revisions, offering tagged template literals increased syntactic freedom.

One capability that had been expected, the updating of Function.prototype.toString, was dropped because there are still concerns about it being working through. The toString () method would have returned a string representing source code for a function.  

Where to download the ECMAScript 2018 specification

You can download the ECMASCript 2018 specification from ECMA International

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author