ECMAScript 2022 blesses class elements, top-level await

[ad_1]

ECMAScript 2022, the subsequent update to the official standard behind JavaScript, has been formally permitted, with new abilities ranging from course features to a prime-degree await capacity.

The ECMAScript 2022 specification was approved by ECMA International on June 22. But the characteristics currently are readily available in most browsers, claimed Robert Palmer, co-chair of the TC39 committee that shepherds the normal, in March. Attribute availability in JavaScript engines is additional relevant to builders than visual appearance in the genuine specification, Palmer claimed.

ECMAScript 2022 has the adhering to new attributes:

  • Prime-level await, letting the await search phrase to be employed at the major amount of modules.
  • New course components, such as community and non-public occasion fields, general public and non-public static fields, and personal instance strategies and accessors.
  • Static blocks within courses, to carry out per-class analysis initialization.
  • The #x in obj#x in obj syntax, to check for the presence of private fields on objects.
  • Common expression match indices through the /d/d flag, which delivers begin and conclude indices for matched substrings.
  • The induce residence on Mistake objects, to be utilized to record a causation chain in problems.
  • The at method for Strings, Arrays, and TypedArrays, allowing for relative indexing and for use of Item.hasOwn, an alternate to Item.prototype.hasOwnProperty.

Past June’s ECMAScript 2021 standardized abilities this kind of as String.prototype.ReplaceAll, for replacing occasions of a substring, and the AggregateError mistake style.

Copyright © 2022 IDG Communications, Inc.

[ad_2]

Resource website link