Answers for "exit forEach when null javascript"

0

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;
});
Posted by: Guest on June-21-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language