JavaScript Bubble Sort Algorithm
Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order.
If the objective is values in crecent form, then the current position is exchanged with the next position, and if the current position is greater than the larger position, the values at that position are exchanged. Otherwise, the exchange is not performed, only the next pair of comparisons is carried out.