ES10 - ECMAScript 2019

Features of ES10

Array.Flat()

let multi = [1,2,3,[4,5,6,[7,8,9,[10,11,12]]]];
multi.flat();               // [1,2,3,4,5,6,Array(4)]
multi.flat().flat();        // [1,2,3,4,5,6,7,8,9,Array(3)]
multi.flat().flat().flat(); // [1,2,3,4,5,6,7,8,9,10,11,12]
multi.flat(Infinity);       // [1,2,3,4,5,6,7,8,9,10,11,12]

Array.flatMap()

let array = [1, 2, 3, 4, 5];
array.map(x => [x, x * 2]);

[Array(2), Array(2), Array(2)]
0: (2)[1, 2]
1: (2)[2, 4]
2: (2)[3, 6]
3: (2)[4, 8]
4: (2)[5, 10]

Object.fromEntries()

String.trimStart() & String.trimEnd()

Optional Catch Binding

Allow developers to use try/catch without creating an unused binding. You are free to go ahead make use of catch block without a param

Function.toString()

The toString() method returns a string representing the source code of the function.Earlier white spaces,new lines and comments will be removed when you do now they are retained with original source code

Symbol.description

The read-only description property is a string returning the optional description of Symbol objects.

Well Formed JSON.Stringify()

To prevent JSON.stringify from returning ill-formed Unicode strings.

Array.Sort Stability

Users with same rating retain their sorting order

Last updated

Was this helpful?