# forEach()

say it: **“for-EECH”** **/fɔrˈitʃ/**

An array method that runs a function once for every item, in order.

## What is **forEach()** in JavaScript?

**forEach()** — An array method that calls a function once for each item, in order, handing it the item and its index. Use it to do something with every item, such as printing it. It gives nothing back, so use `map()` when you want a new array.

```javascript
const playlist = ['Highway Sunrise', 'Desert Radio'];
playlist.forEach((song, index) => {
  console.log(`${index + 1}. ${song}`);
});
// 1. Highway Sunrise
// 2. Desert Radio
```

Level: Apprentice · [More JavaScript terms at this level](https://www.ask-codey.com/glossary?category=javascript&level=2)

Updated: November 17, 2026

Source: https://www.ask-codey.com/glossary/foreach-javascript
