let testArr = [5, 17, 1, 33, 2, 6, 20]; document.write(testArr + "<br/>"); function bubbleSort(arr) { let temp; for (let i = 0; i < arr.length; i++) { for (let j = 0; j < arr.length - 1; j++) { if (arr[j+1] < arr[j]) { temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; } } } return arr; } document.write(bubbleSort(testArr));