• Janarthanan Soundararajan

A Glimpse of Modern JavaScript - Part 3 (ECMAScript 2019 / ES10 / ES2019 Special)

Updated: Jan 17



Welcome to the third part of the 'A Glimpse of Modern JavaScript' blog series. Again JavaScript has upgraded its quality with modern features. ES2019/ES10 have introduced, which packed with great features. We'll see a glimpse of the new updates in this blog post. Let's get started.


Optional Catch

We don't need to specify the exception variable in the catch clause when we are using the try-catch statement.


trimStart and trimEnd

The String.prototype.trim() will remove the unwanted space on a string at start and end. But the String.prototype.trimStart() will remove just the unwanted space at the start of the string. The same case to the String.prototype.trimEnd.


Object.fromEntries(iterable)

The Object.fromEntries(iterable) helps to build the object from key-value pairs. The input of this method must be iterable.


flat

The Array.prototype.flat() helps to flatten the multi-dimensional array. It takes the level of the dimensions as an optional argument. You can send 1, 2 or maybe Infinity as an argument.

Do you know about Infinity in JavaScript?

The Infinity property has a range of infinity. It seems interesting, right? Yes, it used to represent the infinity in JavaScript, which is a numeric type.


flatMap

The Array.prototype.flatMap() first map the array elements then flatten the array.


Symbol

The Symbol is a primitive data type(symbol type). It is a static read-only value.

I hope this post is useful. Please check out another blog posts from this series.




©2020 by Techaaroorian.

  • Pinterest
  • Twitter Social Icon
  • Facebook
  • YouTube