Array.forEach(callback) Last updated: 24. Jan 2023
Iterates all items in the array and executes a function passing the array item as a parameter.
Parameters
Name | Type | Description |
---|---|---|
callback | function | Function to execute for each item. |
Returns
Nothing, executes functions for each item.
Example
Data
{
"items" : [1, 2, 3]
}
Code example (#JS)
#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.#{ items.forEach(x => write(x)); }#
Output
The #JS code above produces the output shown below:123