Nearby lessons

22 of 40

🗑️ JavaScript forEach() Method

📌 What is JavaScript forEach()?

The forEach() method executes a function for each array element.

Functional programming approach to iteration.

📋 forEach Basics

AttributeDescription
Syntaxarray.forEach(callback)
Parametersitem, index, array
NoteCannot use break/continue
Example02
Code Cell
Loading Editor...
✏️ You can edit this code — click Run to refresh the preview.
Output

🧠 Test Your Knowledge

2 Questions
Progress: 0 / 2