Not according to this code I just threw into my browser console:
[0, 1, 2, 3, 4].forEach(e => { if (e == 3) { return; } console.log(`${e}`)})
The above logs 0, 1, 2, undefined, 4. Also the MDN docs state in a big yellow warning box "There is no way to stop a forEach() loop other than by throwing an exception": developer.mozilla.org/en-US/docs/W...
They also recommend using for...of or for...in if breaking out early is desired :) 🙇
Not according to this code I just threw into my browser console:
The above logs 0, 1, 2, undefined, 4. Also the MDN docs state in a big yellow warning box "There is no way to stop a forEach() loop other than by throwing an exception": developer.mozilla.org/en-US/docs/W...
They also recommend using for...of or for...in if breaking out early is desired :) 🙇
Ah good to know indeed!
In most cases, I always want to attach listeners to all, but indeed strong argument!