Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

exit forEach when null javascript

// Prints "1, 2, 3"
[1, 2, 3, 4, 5].every(v => {
  if (v > 3) {
    return false;
  }

  console.log(v);
  // Make sure you return true. If you don't return a value, `every()` will stop.
  return true;
});
Source by masteringjs.io #
 
PREVIOUS NEXT
Tagged: #exit #forEach #null #javascript
ADD COMMENT
Topic
Name
1+8 =