Here is a solution to sort a Javascript array in ascending order
function bubblesort(array){
var done = false;
while(!done){
done = true;
for(var i = 1; i< array.length; i++){
if(array[i -1] > array[i]){
done = false;
var tmp = array[i-1];
array[i-1] = array[i];
array[i] = tmp;
}
}
}
return array;
}
var numbers = [2, 11, 1, 20, 5, 35];
bubblesort(numbers);