JavaScript array.forEach() Function

JavaScript Logo

array.forEach() – Executes the provided function once for each array element (no return value).

๐Ÿ‘‰ Syntax

array.forEach((element, index, array) => {
  // side‑effect only
}, thisArg);

๐Ÿงช Example

['๐ŸŽ','๐ŸŒ','๐ŸŠ'].forEach(fruit => console.log(fruit));

Comments