Answers for "sort array with negative numbers"

-1

sort array with negative numbers

var arr = [10, 5, 40, 25, -3412, 4212, -107.578, 97.453];

function sortNumber(a, b) {
   return a - b;
}

return arr.sort(sortNumber);
Posted by: Guest on March-14-2020

Code answers related to "sort array with negative numbers"

Code answers related to "Javascript"

Browse Popular Code Answers by Language