What’s new in ECMAScript 2018

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

The ECMAScript 2018 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.

You might also like
Leave A Reply

Your email address will not be published.