Table of Contents

  1. forEach Loop
  2. Filter Method
  3. Map Method
  4. Reduce Method
  5. Set Data Structure
  6. Map Data Structure

1. forEach Loop

What is forEach?

forEach is an array method that iterates over each element and executes a callback function for each element.

Syntax

javascript

array.forEach((element, index, array) => { *// code to execute* });

Parameters

Example

javascript