June 22, 2024

hopeforharmonie

Step Into The Technology

ECMAScript 2022 blesses class elements, top-level await

1 min read

[ad_1]

ECMAScript 2022, the following update to the official typical at the rear of JavaScript, has been formally approved, with new capabilities ranging from class factors to a top rated-amount await functionality.

The ECMAScript 2022 specification was accepted by ECMA Intercontinental on June 22. But the functions already are available in most browsers, mentioned Robert Palmer, co-chair of the TC39 committee that shepherds the standard, in March. Function availability in JavaScript engines is far more suitable to builders than visual appearance in the actual specification, Palmer stated.

ECMAScript 2022 has the following new attributes:

  • Prime-degree await, letting the await keyword to be utilized at the prime level of modules.
  • New course components, together with community and non-public instance fields, general public and personal static fields, and personal occasion techniques and accessors.
  • Static blocks in just courses, to perform for every-course analysis initialization.
  • The #x in obj#x in obj syntax, to check for the presence of non-public fields on objects.
  • Normal expression match indices via the /d/d flag, which gives get started and end indices for matched substrings.
  • The result in home on Error objects, to be used to history a causation chain in errors.
  • The at method for Strings, Arrays, and TypedArrays, enabling for relative indexing and for use of Object.hasOwn, an alternate to Object.prototype.hasOwnProperty.

Very last June’s ECMAScript 2021 standardized capabilities such as String.prototype.ReplaceAll, for replacing occasions of a substring, and the AggregateError mistake form.

Copyright © 2022 IDG Communications, Inc.

[ad_2]

Source url

hopeforharmonie.co.uk | Newsphere by AF themes.