ES10 is not as significant as ES6 in terms of new language features but it does add several interesting ones.
const matchIterator = str.matchAll(regExp);
Given a string and a regular expression, matchAll() returns an iterator for the match objects of all matches.
2. Array.flat() & Array.flatMap()
The flat() method creates a new array with all sub-array elements concatenated into it recursively up to the specified depth.
The flatMap() method maps each element using a mapping function and flattens the result into a new array.
3. Dynamic Import
Dynamic import Imports can now be assigned to a variable!
The Object.fromEntries() method transforms a list of key-value pairs into an object. It can be used to perform the reverse of Object.entries()
5. TrimStart() and TrimEnd()
The trimStart() method removes whitespace from the beginning of the string. The trimEnd() method removes whitespace from the end of a string. TrimStart() or trimLeft() do not affect the value of the string itself.
The read-only description property is a string returning the optional description of Symbol objects. It is different than Symbol.prototype.toString() as it does not contain the enclosing “Symbol()” string.
7. Optional Catch Binding
In the past catch clause from a try/catch statement required a variable. Now it allows developers to use try/catch without creating an unused binding. You are free to make use of catch block without a param!
8. Well Formed JSON.stringify()
This update fixes processing of characters U+D800 through U+DFFF and prevent JSON.stringify from returning ill-formed Unicode strings.
9. Array Sort Stability
The previous implementation of V8 used an unstable QuickSort algorithm for arrays containing more than 10 elements. But this is no longer the case.
ES10 uses a stable TimSort algorithm. In this example, Users with same value retain their sorting order.
10. Enhanced toString()
The toString() method returns a string representing the source code of the function. Earlier white spaces, new lines, and comments were removed, now they are retained with original source code.
11. Standardized “globalThis” Object
ES10 added the globalThis object which should be used from now on to access global scope on any platform: The global globalThis property returns the top level global object.