Bubblesort in javascript