Why was Array.prototype.forEach designed to skip undefined values?
forEach executes the provided callback once for each element of the array with an assigned value. It is not invoked for indexes which have been deleted or which have been initialized to undefined.
Look at this console "experiment" I ran:
You can clearly see that Array.forEach does not skip undefined values (that the key here). Only undefined as in deleted will be skipped.
In all browsers except Mozilla Firefox, the forEach function skips elements in the array that have a value of undefined. The function skips unassigned elements in all browsers.