exit foreach when null javascript

Solutions on MaxInterview for exit foreach when null javascript by the best coders in the world

showing results for - "exit foreach when null javascript"
Giulia
25 Mar 2016
1// Prints "1, 2, 3"
2[1, 2, 3, 4, 5].every(v => {
3  if (v > 3) {
4    return false;
5  }
6
7  console.log(v);
8  // Make sure you return true. If you don't return a value, `every()` will stop.
9  return true;
10});
similar questions
queries leading to this page
exit foreach when null javascript