↓ Ir para o conteúdo principal

← todas as notas

📎 Webclip

10 New JavaScript Features in ES2020 That You Should Know

The post says ES2020 is now finalized and gives a tour of the main changes in the JavaScript specification. It focuses on features for larger integers, cleaner module loading, safer property access, and more consistent behavior across runtimes.

Reading notes
#

  • BigInt lets JavaScript represent integers beyond the current 2^53 - 1 limit, and values use an n suffix to mark them as BigInts.
  • Dynamic import lets applications load modules on demand, including conditional loading, without relying on bundlers like Webpack or Babel.
  • Nullish coalescing checks only undefined and null, instead of all falsey values, so empty strings and 0 can still be kept.
  • Optional chaining reads deeply nested properties, function calls, or array access without throwing when an intermediate value is missing.
  • Promise.allSettled waits until every promise is settled, whether resolved or rejected.
  • String#matchAll returns an iterator with all regex matches and captured groups.
  • globalThis provides one global object name that works in browsers, Node, web workers, and other runtimes.
  • Module namespace exports add symmetric syntax such as export * as utils from './utils.mjs'.
  • The order of for...in loops is now formally defined in ES2020.
  • import.meta gives module metadata, including a url property for the module base URL.