<script>
const l = [2,1,4,5,3]
for(var i = l.length-1;i >= 1; i--){ // 4 // 3 // 2 // 1
for(var j = 0; j < i; j++){ // 0 1 2 3 // 0 1 2 // 0 1 // 0
if(l[j] > l[j+1]){
let a = l[j]
l[j] = l[j+1]
l[j+1] = a
}
}
}
console.log(l)
</script>