fjord/sort.js
2024-02-23 22:01:55 +09:00

12 lines
241 B
JavaScript

var sortNumber = function (number) {
number.sort(function (a, b) {
if (a === b) {
return 0;
}
return a < b ? -1 : 1;
});
};
var number = [19, 3, 81, 1, 24, 21];
sortNumber(number);
console.log(number);