1464
I am trying to get the highest and lowest value from an array that I know will contain only integers, and it seemed to be harder than I thought.
var numArray = [140000, 104, 99];
numArray = numArray.sort();
console.log(numArray)
I'd expect this to show 99, 104, 140000. Instead, it shows 104, 140000, 99. So it seems the sort is handling the values as strings.
Is there a way to get the sort function to sort on the integer value of each array element?