var arr =[4,1,2,3,6,5];
for(var j = 0; j < arr.length; j++){
for(var i = j+1; i < arr.length; i++){
if(arr [j] > arr[i]){
var temp = arr[j];
arr[j]= arr[i];
arr[i]= temp;
}
}
}
for(var x in arr){
document.write(arr[x] + " ")
}
var arr =[4,1,2,3,6,5];
for(var j = 0; j < arr.length; j++){
for(var i = j+1; i < arr.length; i++){
if(arr [j] > arr[i]){
var temp = arr[j];
arr[j]= arr[i];
arr[i]= temp;
}
}
}
for(var x in arr){
document.write(arr[x] + " ")
}