var bubbleSort = function(arr){
var count = 0
for (var i = 0; i < arr.length; i++) {
if (arr[i] > arr[i+1]){
var t = arr[i]
arr[i] = arr[i+1]
arr[i+1] = t
count ++
}
}
if (count >0){
bubbleSort(arr)
}
return arr
}
console.log(bubbleSort([3,5,8,2,3,4,8,9]))