0
JS how can I âcontinueâ array of items, if i == the array....
ââââââââââââ- var rmv = [3, 7]; var i = 0; for (i = 0; i < 10; i++){ if(i == rmv[3]){ continue; } console.log(i) } ââââââââââââââ So, if i == 3, or 7, continue. I could do it using if (i == 3 || if I == 7){ continue; } Iâm observing if there is a shorter way to do it _ like a loop maybe like I started it_ https://code.sololearn.com/W7OL5iBRnfbQ/?ref=app
2 RĂ©ponses
+ 1
Try this:
var rmv = [3, 7];
var i = 0;
for (i = 0; i < 10; i++){
if(rmv.includes(i)){
continue;
}
console.log(i)
}
+ 1
@ChalticDawg
That works.
Thanks.