ECMAScript 2022 blesses class elements, high-level expectation
ECMAScript 2022 has the following new features:
- High-level expectation, allowing the
awaitkeyword to use at the top level of modules.
- New class elements, including public and private instance fields, public and private static fields, and private instance methods and accessors.
- Static blocks within classes, to perform per-class evaluation initialization.
#x in obj#x in objsyntax, to test the presence of private fields on objects.
- Regular expression matching index via the
/d/dflag, which provides start and end indices for matching substrings.
Errorobjects, to be used to record a causal chain in errors.
atmethod for Strings, Arrays and TypedArrays, allowing relative indexing and the use of
Object.hasOwnan alternative to
ECMAScript 2021 standardized capabilities from last June such as
String.prototype.ReplaceAllto replace instances of a substring, and the
AggregateError type of error.
Copyright © 2022 IDG Communications, Inc.