📜  javascript 代码示例为 null 时退出 forEach

📅  最后修改于: 2022-03-11 15:01:40.548000             🧑  作者: Mango

代码示例1
// 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;
});