function bubleSort(arr) {
for(let i = 0; i < arr.length - 1; i++) {
for( let j = 0; j < arr.length - 1 - i; j++) {
if( arr[j] > arr[j+1]) {
const temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}
}
const arr = [1,3,4,2,4,1,56,34,22];
bubleSort(arr);
console.log(arr)