There are several differences between forEach and using a for loop
The most obvious is how they deal with sparse arrays. forEach wont try to run the callback if it hits an empty array element but for will and the array item will give undefined.
On the other side, you can’t just break out of a forEach as you can a for loop.
CLICK HERE to find out more related problems solutions.