// this example uses the inspect() function from the prototype.js framework var t = [4,2,5,1,3,6,9,7,8,3,4,2,7,8,3,1,1,1,2,3,4,3,4,5,7]; // algorithm for ordering an array for(var r = (t.length - 1); r > 0; r--) { for (var p = 0; p < r; p++) { if (t[p] > t[p+1]) { var a = t[p]; var b = t[p+1]; t[p] = b; t[p+1] = a; } } } t.inspect();