Is it impossible to use 'continue' with forEach ? Following gives errors.
var numbers = [4, 9, 16, 25];
function myFunction() {
numbers.forEach(function(val){
if(index==2){
continue;
}
alert('val: '+val);
});
}
Is there any other work around to use continue?
Is it impossible to use 'continue' with forEach ?
Yes.
Is there any other work around to use continue?
Use return to exit a function immediately.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With