Buble Sort

Run Settings
LanguageJavaScript
Language Version
Run Command
const numbers = [3,11,2,5,3,9,7,5,3]; const bubbleSort = arr => { for(let i=0; i<arr.length; i++) { for(let j=0; j<arr.length-i; j++) { if(arr[j] > arr[j+1]) { [ arr[j], arr[j+1] ] = [ arr[j+1], arr[j] ]; } } } } bubbleSort(numbers); console.log(numbers);
Editor Settings
Theme
Key bindings
Full width
Lines