Is one way more efficient? Are there any limitations in one method versus the other? Thanks for any input you guys can give me ;-)
The Array.prototype.forEach
method is part of the ECMAScript 5th Edition Specification, is available on all browsers but not in IE.
I would suggest you to use a simple sequential for
loop, IMO is more efficient since forEach
needs a callback function, a function will be created starting a closure and you don't need to care about IE.
But if you want to use forEach
and all the other new Array.prototype
methods such as map
, filter
, every
, some
, etc... you can add an implementation for IE, in the pages I linked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With