The classic static block proposal adds the ability for JavaScript classes to have one or more static initialization blocks. These blocks are initialized once per evaluation of the class definition. ``` class C { static s_field; static { this.s_field = doSomeInitialization(); } } ```

Specification

Editor's draft

Status in Chromium

Blink>JavaScript>Language


In developer trial (Behind a flag) (tracking bug) in:

  • Chrome for desktop release 91
  • Chrome for Android release 91

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

Owner

Comments

This is a Stage 3 TC39 proposal.

Last updated on 2021-04-09