JavaScript Array toSorted() Method
The JS arr.toSorted() method rearranges the array elements alphabetically and returns a new sorted array.Sorting Array of StringsJavaScriptconst arr = ["JS", "HTML", "CSS"]; const arr1 = arr.toSorted(); console.log(arr); console.log(arr1);Output[ 'JS', 'HTML', 'CSS' ][ 'CSS', 'HTML', 'JS' ]Array.toS