ECMAScript 2022 blesses class elements, top-level await

ByJosephine J. Romero

Jun 28, 2022 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
How to start your own website

[ad_1]

ECMAScript 2022, the future update to the official regular powering JavaScript, has been formally accredited, with new capabilities ranging from class features to a leading-amount await functionality.

The ECMAScript 2022 specification was authorised by ECMA Worldwide on June 22. But the features currently are available in most browsers, explained Robert Palmer, co-chair of the TC39 committee that shepherds the standard, in March. Element availability in JavaScript engines is much more applicable to builders than appearance in the actual specification, Palmer reported.

ECMAScript 2022 has the subsequent new attributes:

  • Leading-level await, allowing the await search term to be employed at the major level of modules.
  • New class aspects, such as community and personal instance fields, community and personal static fields, and private instance strategies and accessors.
  • Static blocks inside courses, to execute per-course evaluation initialization.
  • The #x in obj#x in obj syntax, to exam for the existence of personal fields on objects.
  • Standard expression match indices via the /d/d flag, which delivers get started and close indices for matched substrings.
  • The result in property on Error objects, to be used to report a causation chain in errors.
  • The at system for Strings, Arrays, and TypedArrays, allowing for for relative indexing and for use of Object.hasOwn, an choice to Object.prototype.hasOwnProperty.

Past June’s ECMAScript 2021 standardized capabilities this kind of as String.prototype.ReplaceAll, for changing instances of a substring, and the AggregateError mistake sort.

Copyright © 2022 IDG Communications, Inc.

[ad_2]

Source link