[Solved] How do I write a loop that skips certain iterations? [closed]


function myFunction(num) {
    let i = 0;
    let str = "";

    while(i < num) {
        i++;
        str = str + i + ",";
        if(i % 3 === 0) {
            i = 3 + i;
        }
    }
    str = str.substring(0, str.length - 1);
    console.log(str);
}

myFunction( 29 );

2

solved How do I write a loop that skips certain iterations? [closed]