RosettaCodeData/Task/Sort-an-integer-array/JavaScript/sort-an-integer-array.js

7 lines
136 B
JavaScript
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
function int_arr(a, b) {
return a - b;
}
var numbers = [20, 7, 65, 10, 3, 0, 8, -60];
numbers.sort(int_arr);
document.write(numbers);