const bubbleSort = (arr) => {
let temp = 0;
for (let i = 0; i < arr.length; i++) {
for (let j = 1; j < arr.length; j++) {
if (arr[j - 1] > arr[i]) {
temp = arr[j - 1];
arr[j - 1] = arr[i];
arr[i] = temp;
}
}
}
return arr;
};
console.log(bubbleSort([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]));