Breaking out of a forEach loop in JavaScript
In JavaScript we can use the break keyword to immediately stop iterating through a for loop. There is no equivalent for the forEach() loop, which is much more commonly used today.
An alternative that will achieve the same behavior is using the every(...