Skip to content

infinite loop if the array to be sorted, printed is set to more that 100 items #13

@altamimib

Description

@altamimib

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions