Skip to content

Commit f6c35bd

Browse files
author
Christian Bender
authored
Merge pull request #53 from christianbender/fixed_cocktailShakerSort
fixed the function cocktailShakerSort and added the let-statment.
2 parents 91c19d6 + 3367dc1 commit f6c35bd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sorts/cocktailShakerSort.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
*/
77
function cocktailShakerSort(items) {
88

9-
for (var i = items.length - 1; i > 0; i--) {
10-
var swapped = false;
11-
var temp, j;
9+
for (let i = items.length - 1; i > 0; i--) {
10+
let swapped = false;
11+
let temp, j;
1212

1313
// backwards
14-
for (j = 0; j > i; j--) {
14+
for (j = items.length -1; j > i; j--) {
1515
if (items[j] < items[j - 1]) {
1616
temp = items[j];
1717
items[j] = items[j - 1];

0 commit comments

Comments
 (0)