November 20, 2024

Baskentmuhendislik

The technology folks

ECMAScript 2022 blesses class elements, top-level await

[ad_1]

ECMAScript 2022, the future update to the official regular at the rear of JavaScript, has been formally approved, with new capabilities ranging from course aspects to a leading-degree await ability.

The ECMAScript 2022 specification was accredited by ECMA Worldwide on June 22. But the characteristics now are offered in most browsers, stated Robert Palmer, co-chair of the TC39 committee that shepherds the common, in March. Aspect availability in JavaScript engines is far more pertinent to developers than overall look in the real specification, Palmer claimed.

ECMAScript 2022 has the next new options:

  • Top-stage await, permitting the await search term to be made use of at the top degree of modules.
  • New class things, including public and private occasion fields, general public and non-public static fields, and personal occasion procedures and accessors.
  • Static blocks in just lessons, to conduct per-course evaluation initialization.
  • The #x in obj#x in obj syntax, to take a look at for the existence of private fields on objects.
  • Standard expression match indices by means of the /d/d flag, which features get started and conclude indices for matched substrings.
  • The result in residence on Mistake objects, to be utilized to record a causation chain in glitches.
  • The at approach for Strings, Arrays, and TypedArrays, allowing for relative indexing and for use of Object.hasOwn, an substitute to Item.prototype.hasOwnProperty.

Last June’s ECMAScript 2021 standardized capabilities these types of as String.prototype.ReplaceAll, for changing instances of a substring, and the AggregateError mistake variety.

Copyright © 2022 IDG Communications, Inc.

[ad_2]

Supply connection