(function fn() {
let temp
for (let j = arr.length - 2; j >= 0; j--) {
for (let i = 0; i <= j; i++) {
if (arr[i] > arr[i + 1]) {
temp = arr[i]
arr[i] = arr[i + 1]
arr[i + 1] = temp
}
}
}
console.log(arr);
})
(function fn() {
let temp
for (let j = arr.length - 2; j >= 0; j--) {
for (let i = 0; i <= j; i++) {
if (arr[i] > arr[i + 1]) {
temp = arr[i]
arr[i] = arr[i + 1]
arr[i + 1] = temp
}
}
}
console.log(arr);
})