filmov
tv
JavaScript Array sort() vs toSorted() (new in ES 2023)
![preview_player](https://i.ytimg.com/vi/LkGCDD0tXQI/maxresdefault.jpg)
Показать описание
We all know that the JavaScript array sort() method sorts an array. So why do we need a toSorted() method?
toSorted() is new in ECMAScript 2023, also known as ES 14, which is the standard for JavaScript.
In this video, we look the array sort() and toSorted() methods. The sort() method sorts the array in place, mutating the original array. And toSorted() creates a new sorted array from the original array, treating the original array as immutable.
toSorted() is a great choice when working in applications that support immutable patterns such as state management libraries and functional programming techniques.
*Links*
*Content*
00:00 Array sort() vs toSorted()
00:36 Array sort() method is mutable
01:49 Issues with a mutable sort
02:43 Array toSort() method is immutable
03:02 toSort() supported in ES 2023 and TypeScript 5.2
03:59 Array toSort() method is immutable (continued)
05:01 Wrap Up
05:30 Setting up Angular to work with ES 2023
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
😊About Me
Hey! I'm Deborah Kurata
I'm a software developer and YouTube content creator. I speak at conferences such as VS Live and ng-conf. I write articles for freeCodeCamp. And I'm a Pluralsight author with courses in the top 10 most popular (out of 7,000+) over the past 5 years. For my work in support of software developers, I've been recognized with the Microsoft Most Valuable Professional (MVP) award, and I'm a Google Developer Expert (GDE).
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
#javascript #sort #tosorted #sortvstostored #es14 #es2023 #angularandes2023
toSorted() is new in ECMAScript 2023, also known as ES 14, which is the standard for JavaScript.
In this video, we look the array sort() and toSorted() methods. The sort() method sorts the array in place, mutating the original array. And toSorted() creates a new sorted array from the original array, treating the original array as immutable.
toSorted() is a great choice when working in applications that support immutable patterns such as state management libraries and functional programming techniques.
*Links*
*Content*
00:00 Array sort() vs toSorted()
00:36 Array sort() method is mutable
01:49 Issues with a mutable sort
02:43 Array toSort() method is immutable
03:02 toSort() supported in ES 2023 and TypeScript 5.2
03:59 Array toSort() method is immutable (continued)
05:01 Wrap Up
05:30 Setting up Angular to work with ES 2023
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
😊About Me
Hey! I'm Deborah Kurata
I'm a software developer and YouTube content creator. I speak at conferences such as VS Live and ng-conf. I write articles for freeCodeCamp. And I'm a Pluralsight author with courses in the top 10 most popular (out of 7,000+) over the past 5 years. For my work in support of software developers, I've been recognized with the Microsoft Most Valuable Professional (MVP) award, and I'm a Google Developer Expert (GDE).
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
#javascript #sort #tosorted #sortvstostored #es14 #es2023 #angularandes2023
Комментарии