practice13(소팅).js
337 Bytes
var sort = function(arr){
for(var i = 0; i < arr.length-1; i ++){
for(var j = i+1; j < arr.length; j++){
if(arr[i]>arr[j]){
var temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
};
var arr = [5,4,3,2,1,0];
console.log("before sort" + arr);
sort(arr);
console.log("after sort " + arr);