How to break out of the forEach in JavaScript

Array.prototype.forEach forEach is such an useful method. Example: Output: It’s still iterating through all items in the array. What should I do if I want to stop the loop based on the condition? It’s simple: Don’t use forEach. Use some or every. Array.prototype.some some is pretty much the same as forEach but it break when […]

Read More