Hi All,
the task is failed on 2 and 3

  1. myLoop function should print numbers from 0 to 99

  2. myLoop function should use a while loop

    I cannot understand what is wrong with the code. I've got 100 lines and I am using While loop in the function
    `let i = 0;

export const myLoop = () => {
while (i <= 99) {
console.log(i);
i++;
}
};`

  • Hello. You need to move the variable i to the scope of the function.
    export const myLoop = () => {
    let i=0;
    while (i <= 99) {
    console.log(i);
    i++;
    }
    }
    ;

Hello. You need to move the variable i to the scope of the function.
export const myLoop = () => {
let i=0;
while (i <= 99) {
console.log(i);
i++;
}
}
;

Write a Reply...