Short circuit Array.forEach like calling break
There’s no built-in ability to break in forEach. To interrupt execution you would have to throw an exception of some sort. eg. Run code snippetExpand snippet JavaScript exceptions aren’t terribly pretty. A traditional for loop might be more appropriate if you really need to break inside it. Use Array#some Instead, use Array#some: Run code snippetExpand snippet This works because some returns true as soon as any of the … Read more