Skip to content

Instantly share code, notes, and snippets.

@jairhumberto
jairhumberto / bubbleSort.js
Created February 16, 2022 15:32
My implementation of Bubble sort
function bubbleSort(array) {
for (let i=1, sorted; !sorted; i++) {
sorted = 1;
for (let j=0; j < array.length - i; j++) {
if (array[j] > array[j+1]) {
[array[j+1], array[j], sorted] = [array[j], array[j+1], 0];
}
}
}