Replaced use of var with const | Bubble Sort

This commit is contained in:
marsonya
2021-01-24 23:30:20 +05:30
parent bf3d37a974
commit b61d6020a1

View File

@ -53,7 +53,7 @@ function bubbleSort (items) {
/* /*
* Implementation of 2 for loops method * Implementation of 2 for loops method
*/ */
var array1 = [5, 6, 7, 8, 1, 2, 12, 14] const array1 = [5, 6, 7, 8, 1, 2, 12, 14]
// Before Sort // Before Sort
console.log('\n- Before Sort | Implementation using 2 for loops -') console.log('\n- Before Sort | Implementation using 2 for loops -')
console.log(array1) console.log(array1)
@ -84,7 +84,7 @@ function alternativeBubbleSort (arr) {
/* /*
* Implementation of a while loop and a for loop method * Implementation of a while loop and a for loop method
*/ */
var array2 = [5, 6, 7, 8, 1, 2, 12, 14] const array2 = [5, 6, 7, 8, 1, 2, 12, 14]
// Before Sort // Before Sort
console.log('\n- Before Sort | Implementation using a while loop and a for loop -') console.log('\n- Before Sort | Implementation using a while loop and a for loop -')
console.log(array2) console.log(array2)