fjord/sort.js

13 lines
241 B
JavaScript
Raw Normal View History

var sortNumber = function (number) {
number.sort(function (a, b) {
2024-02-23 22:01:55 +09:00
if (a === b) {
return 0;
}
return a < b ? -1 : 1;
});
};
var number = [19, 3, 81, 1, 24, 21];
sortNumber(number);
console.log(number);