forEach() is an array function from Node.js that is used to iterate over items in a given array.
Parameter: This function takes a function (which is to be executed) as a parameter.
Return type: The function returns array element after iteration.
The program below demonstrates the working of the function:
cat dog fish
1 2 3 8 7
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.