Bubble Sort is a simple algorithm. It works by checking each item in the list that is going to be ordered with the next one, swapping them if they are in the wrong order.
$ npm install bubblesort-algorithm
Function receives a disordered Array:
Ej: [1, 9, 5, 2, 10, 6, 3, 7, 8, 4]
const bubbleSort = require("bubblesort-algorithm");
let array = [1, 9, 5, 2, 10, 6, 3, 7, 8, 4];
bubbleSort(array);
console.log(array);