|
if (randomNumbers.indexOf(nextNumber) === -1) { |
|
randomNumbers.push(nextNumber); |
|
} else { |
|
counter--; |
|
} |
This results in infinite loop if the array to be sorted, printed is set to more that 100 items. The solution is:
randomNumbers.push(nextNumber); // if (randomNumbers.indexOf(nextNumber) === -1) { // } else { // counter--; // }
comment out / or delete, the conditional if else clause to remove redundancy
mslearn-typescript/code/module-05/m05-end/module05.ts
Lines 53 to 57 in 10bb2e3
This results in infinite loop if the array to be sorted, printed is set to more that 100 items. The solution is:
randomNumbers.push(nextNumber); // if (randomNumbers.indexOf(nextNumber) === -1) { // } else { // counter--; // }comment out / or delete, the conditional if else clause to remove redundancy