0 points

How to sort an array numerically in JavaScript | by Dr. Derek Austin 🥳 | Coding at Dawn | Medium


dashboard

Thu Oct 15 2020 16:09:37 GMT+0000 (UTC)

Posted by @eneki

// Ascending order
array.sort((a,b) => a-b)

// Descending order
array.sort((a,b) => b-a)
content_copy Copy

https://medium.com/coding-at-dawn/how-to-sort-an-array-numerically-in-javascript-2b22710e3958