ECMAScript 2022, the subsequent replace to the official normal behind JavaScript, has been formally authorized, with new capabilities starting from class components to a top-level await functionality.
The ECMAScript 2022 specification was authorized by ECMA Worldwide on June 22. However the options already can be found in most browsers, mentioned Robert Palmer, co-chair of the TC39 committee that shepherds the usual, in March. Characteristic availability in JavaScript engines is extra related to builders than look within the precise specification, Palmer mentioned.
ECMAScript 2022 has the next new options:
- High-level await, permitting the
await
key phrase for use on the high stage of modules. - New class components, together with private and non-private occasion fields, private and non-private static fields, and personal occasion strategies and accessors.
- Static blocks inside lessons, to carry out per-class analysis initialization.
- The
#x in obj#x in obj
syntax, to check for the presence of personal fields on objects. - Common expression match indices through the
/d/d
flag, which affords begin and finish indices for matched substrings. - The
trigger
property onError
objects, for use to document a causation chain in errors. - The
at
technique for Strings, Arrays, and TypedArrays, permitting for relative indexing and to be used ofObject.hasOwn
, a substitute forObject.prototype.hasOwnProperty
.
Final June’s ECMAScript 2021 standardized capabilities comparable to String.prototype.ReplaceAll
, for changing cases of a substring, and the AggregateError
error sort.
Copyright © 2022 IDG Communications, Inc.