Rule Definition
Even though function-based iteration represents a more convenient method of iteration, it is also quite a bit slower than loop-based iteration. The slowdown can be accounted for by the overhead associated with an extra method being called on each array item. In all cases, function-based iteration takes up to eight times as long as loop-based iteration and therefore isn't a suitable approach when execution time is a significant concern.
Remediation
Use the regular for loop to enumerate the array
Violation Code Sample
arr.forEach(function(v){v;}); // BAD
Fixed Code Sample
for(var i = 0, l = arr.length; i < l; i++){arr[i];} // GOOD
Reference
CISQ OMG, http://jsperf.com/foreach-vs-loop
Related Technologies
HTML5
Technical Criterion
Efficiency - SQL and Data Handling Performance
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.