var a =[9,8,7,6,5,4,3,2,1]; var b = 0; for(var i=0; i<a.length-1;i++) { for(var s=0; s<a.length-1;s++) { if (a [s] > a [s+1]) { b = a [s]; a [s] = a[s+1]; a [s+1] = b; } } } alert(a);
var a =[9,8,7,6,5,4,3,2,1]; var b = 0; for(var i=0; i<a.length-1;i++) { for(var s=0; s<a.length-1;s++) { if (a [s] > a [s+1]) { b = a [s]; a [s] = a[s+1]; a [s+1] = b; } } } alert(a);