style: Fixed most styles (according to standardjs)

This commit is contained in:
Rak Laptudirm
2021-05-21 11:16:11 +05:30
parent 37ef611136
commit ca4c1a62af
22 changed files with 176 additions and 176 deletions

View File

@@ -5,9 +5,9 @@
* the correct position and expand sorted part one element at a time.
*/
function insertionSort (unsortedList) {
var len = unsortedList.length
for (var i = 1; i < len; i++) {
var tmp = unsortedList[i] // Copy of the current element.
const len = unsortedList.length
for (let i = 1; i < len; i++) {
const tmp = unsortedList[i] // Copy of the current element.
/* Check through the sorted part and compare with the number in tmp. If large, shift the number */
for (var j = i - 1; j >= 0 && (unsortedList[j] > tmp); j--) {
// Shift the number
@@ -19,6 +19,6 @@ function insertionSort (unsortedList) {
}
}
var arr = [5, 3, 1, 2, 4, 8, 3, 8]
const arr = [5, 3, 1, 2, 4, 8, 3, 8]
insertionSort(arr)
console.log(arr)