DEV Community 👩‍💻👨‍💻

Discussion on: New JavaScript Features ECMAScript 2022 (with examples)

Collapse
lukeshiru profile image
Luke Shiru

Nice summary. Just to clarify, these aren't "new new", they were actually released in 2021 or earlier, not 2022:

  • Top-level await: Available since 2021 in browsers, 2020 in Node.
  • Private instance fields, methods, and accessors: Available since 2019 in browsers and Node.
  • Static class fields and methods: Available since 2016 in browsers and Node.
  • Static class initialization blocks: Available since 2021 in browsers and Node.
  • Error: .cause: Available since 2021 in browsers and Node.
  • Array, String, and TypedArray: .at() Method: Available since 2021 in browsers and Node.
  • Object: .hasOwn(): Available since 2021 in browsers and Node.
  • RegExp: match .indices ('d' flag): Available since 2021 in browsers and Node.

You can check the dates by looking at the compatibility table in MDN for each feature (for hasIndices it says Node doesn't support that, but it was added on Node 16, so the article is just outdated).

Cheers!