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 odpowiedzi
+ 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.