jPaq Docs - Array.prototype.forEach()

Quick Stats

Target Platforms:  PC (JScript) and the web (JavaScript)
Download Count:  890

Summary

Calls a function for each element in the array.

Parameters

  1. fn => Function
    The function that will be executed for every element within the array. The first parameter passed will be the element within the array that is being examined. The second parameter is the index of the element. The third parameter is a reference to the array. The keyword "this" will refer to whatever is passed in as "objThis".
  2. [objThis] => Object
    Optional. If specified, the "this" keyword will refer to this parameter.

Related Examples

  1. Cartesian Product
    A few weeks ago, I came across a question about finding the cartesian product of two or more arrays in JavaScript.  The following is…
  2. Counting Squares On A Checker Board
    How many squares are there on a checker board?  Most people would say there are only 64 squares, but others would say what about…
  3. Currying
    At times, you may want to call a function a number of times, but you may notice that the first few arguments are always the…