What’s new in Javascript?

Jijin P 👨‍💻🦄 - May 13 '19 - - Dev Community

Some of the new features are still proposal / not compatible in all browsers. So if you are playing with the code, try to use Google Chrome.
And some of them may

Private Fields

img
From the counterDemo class, the #counter value is private. If we try to access the #counter, then syntax error will be shown.

Big Int Multiplication

img

We can multiply 1234567890123456789n * 123n and obtain the correct value if we use BigInt.

Array Flat

img
Array.flat will convert nested array items to a flat list. By default, it will convert 1 level deep. You can use

const array = [ 1, [2 , [3 , 4 , [5 , 6 ] ]]]
array.flat(Infinity);
The output will be 1 2 3 4 5 6. if we use Infinity it will recursively convert to a flat list.

Object.fromEntries

img

We have use Object.entries in many cases. It will return an array from an object. Similarly, we can use the Object.fromEntries that will return the object from an array.

. . . . .
Terabox Video Player