Array Iteration Methods:
JavaScript array iteration means the process of going through each element of an array one by one and performing some operation on it.
Types of Array iteration Methods:
1.Array forEach
2.Array map()
3.Array flatMap()
4.Array filter()
5.Array reduce()
6.Array reduceRight()
7.Array every()
8.Array some()
9.Array from()
10.Array keys()
11.Array entries()
12.Array with()
13.Array Spread (...)
14.Array Rest (...)
1.Array forEach:
This method calls a fuction (call back function) once for each array element.No return value.
👉 Explanation:
1)Run each element
2)Runs the function
3)Does not create a new array.
2.Array map()
This method creates a new array by performing function on each array element.It's not execute the function for array elements without values.this method not change the original array.it"s create a duplicate array.
the function takes 3 arguments:
The item value
The item index
The array.
👉 Explanation:
1.Takes each value
2.Applies logic
3.Stores results in a new array.
3.Array flatMap()
This method first maps all elements of an array and then creates a new array by flattening the array.
syntax

👉 Explanation:
1.First maps values
2.Then flattens one level.
4.Array filter()
This method creates a new array with array elements that pass a test.
The function takes 3 arguments:
The item value
The item index
The array itself
Syntax



Top comments (0)