ES2022 feature: class static initialization blocks

129 · Axel Rauschmayer · Sept. 1, 2021, 10:41 a.m.
The ECMAScript proposal “Class static initialization blocks” by Ron Buckton is at stage 4 and scheduled to be included in ECMAScript 2022. For setting up an instance of a class, we have two constructs in JavaScript: Field: Create (and optionally initialize) instance properties. Constructor: A block of code that is executed before setup is finished. For setting up the static part of a class, we only have static fields. The ECMAScript proposal introduces static initialization blocks for classes,...