

flat() converts nested Arrays into flat Arrays. Mapping single input values to multiple output valuesĪrray method.

The returned Arrays are then concatenated and become the result of. map() but lets the callback return Arrays of zero or more values instead of single values. The following features were added in ECMAScript 2019:Īrray method. For more information on it, see its proposal. GlobalThis provides a way to access the global object that works both on browsers and server-side platforms such as Node.js and Deno.įor-in mechanics: This feature is beyond the scope of this book. The fulfillment value is an Array with one object per input Promise – either one of: It returns a Promise that is fulfilled once all the input Promises are settled. Promise.allSettled() receives an iterable of Promises. (): This method throws if flag /g isn’t set and returns an iterable with all match objects for a given string. It supports integer numbers that can be arbitrarily large (storage for them grows as necessary). Previously the Logical Or operator ( ||) was used in this case but it has downsides here because it returns the default value whenever the left-hand side is falsy (which isn’t always correct).īigints – arbitrary-precision integers: Bigints are a new primitive type. This operator lets us use a default value whenever something is missing. This expression is defaultValue if value is either undefined or null and value otherwise. Private slot checks (“ergonomic brand checks for private fields”): The following expression checks if obj has a private slot #privateSlot: Private methods and accessors ( non-static and static).Private fields ( instance private fields and static private fields).Private slots are new and can be created via:.Properties (public slots) can now be created via:.The following proposals have reached stage 4 and are scheduled to be part of that standard: 4.1 New in ECMAScript 2022ĮS2022 will probably become a standard in June 2022. It starts after ES2015 (ES6) because that release has too many features to list here. This chapter lists what’s new in ES2016–ES2022 in reverse chronological order.
