Exploring new features of ECMAScript 2023

 Exploring New Features of ECMAScript 2023

As  javascript continuously to evolve , we as a javascript developers eagerly would like to explore and use in our projects to increase the productivity in writing the code and achieving efficiency. So, let's explore the ECMAScript 2023 Javascript features.

1) .with()

Earlier when we want to update some changes , the original array is altered and we get to see some side effects due to the same array changed . But .with() method can return the duplicate array with the changes. 

In this example , you can see the old way of updating the array and with the use of new feature the array can be easily update without altering the original array.
 

2) .toSpliced()

This method in javascript is used to pull out the specific element and with the number of number of element to pull out is mentioned in the parameters . Earlier , with the splice() 
method the array is altered with the desired result but can cause some side effects.

So, ECMAScript came up with the new method .toSpliced() which function like splice , but it updates in the duplicate returned array and not altered the original array.

You can look at the the below example , where I have specified the old way of splice and new method of splice.



3) .toReversed()

This method in javascript is used to reverse the array and not altered the original array.
Here, in this example we have an array of month in the chronological order but we want to reverse the array without altering the months array.

We will do this reverse with the help of new method .toReversed() method in the new ECMAScript 2023 .


This are some of the new features in javascript of ECMAScript 2023 which makes the developer efficient with the code and one should use them in their daily life to increase productivity.

Thank you for reading :)


Comments

Popular posts from this blog

Learn React Router v6 ( Part - 2)

Why use Typescript ?

What is Single Page Application Routing ?