配列をソートする処理を追加しました

This commit is contained in:
Rikuoh Tsujitani 2024-02-23 21:57:06 +09:00
parent 3d46c55fe8
commit c6690b2fe1
Signed by: riq0h
GPG key ID: 010F09DEA298C717

12
sort.js Normal file
View file

@ -0,0 +1,12 @@
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);