Skip to content

Instantly share code, notes, and snippets.

@4skinSkywalker
Created April 23, 2019 08:14
Show Gist options
  • Select an option

  • Save 4skinSkywalker/92512d0cd16141e48c155a6859fe1715 to your computer and use it in GitHub Desktop.

Select an option

Save 4skinSkywalker/92512d0cd16141e48c155a6859fe1715 to your computer and use it in GitHub Desktop.
function bubbleSort(array) {
for (var i = 0; i < array.length; i++) {
for (var j = 1; j < array.length - i; j++) {
if (array[j - 1] > array[j]) {
[array[j - 1], array[j]] = [array[j], array[j - 1]]
}
}
}
return array
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment