Below are the various ways you can use a forEach loop in Javascript starting with the simplest, where you only need to work with the current element of the forEach loop, down to the most complex form of the Javascript forEach loop, using current element, index, the array that was passed to the forEach loop and optional parameter that specifies the value that will be used in the callback function.
There is no elegant way to break out of a forEach loop in Javascript. An alternative which is very similar to the forEach is ...
OR ...