Break a forEach Loop with JavaScript

1 · David Walsh · Dec. 22, 2020, 12:01 p.m.
I’ve written a number of blog posts about JavaScript tricks: Promise tricks, type conversion tricks, spread tricks, and a host of other JavaScript tricks. I recently ran into another JavaScript trick that blew my mind: how to break a forEach loop. To break the forEach loop at any point, you can truncate the array’s length: […] The post Break a forEach Loop with JavaScript appeared first on David Walsh Blog. ...