Why was Array.prototype.forEach designed to skip undefined values?

The doc of Array.prototype.forEach says:

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:

Image link

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.

From: https://msdn.microsoft.com/en-us/library/bb397509.aspx

Need Your Help

Unit testing SuiteScripts and NetSuite Workflows in NetSuite

unit-testing scripting netsuite

I was looking for the options on how to unit test NetSuite SuiteScripts and workflows? Is there any framework for that??

Roslyn CTP to RTM upgrade - How to use formatter

c# roslyn roslyn-code-analysis

In CTP version, I used to write below code to save the changes to file with the formatting. Any idea what is changed in RTM?