sort array by descending javascript code example
Example 1: javascript order by string array
users.sort((a, b) => a.firstname.localeCompare(b.firstname))
Example 2: sort js
numArray.sort((a, b) => a - b); // For ascending sort
numArray.sort((a, b) => b - a); // For descending sort