Answers for "javascript sortr"

25

JS array sort

numArray.sort((a, b) => a - b); // For ascending sort
numArray.sort((a, b) => b - a); // For descending sort
Posted by: Guest on May-08-2021
2

javascript sort function

var points = [40, 100, 1, 5, 25, 10];
points.sort((a,b) => a-b)
Posted by: Guest on May-08-2020
1

javascript sort array in ascending order

//sorts arrays of numbers
function myFunction() {
  points.sort(function(a, b){return a-b});
  document.getElementById("demo").innerHTML = points;
}
Posted by: Guest on March-25-2020
-1

sort javascript

arr.sort()
arr.sort(fonctionComparaison)
Posted by: Guest on April-14-2021

Browse Popular Code Answers by Language