belongs to collection: Node.js programming Exercises
How do you iterate over the given array in node.js
['fish', 'crab', 'dolphin', 'whale', 'starfish']
Node.js provides forEach()function that is used to iterate over items in a given array.
const arr = ['fish', 'crab', 'dolphin', 'whale', 'starfish']; arr.forEach(element => { console.log(element); });
Output of the above code:
fish crab dolphin whale starfish
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Solution
Node.js provides forEach()function that is used to iterate over items in a given array.
Output of the above code:
need an explanation for this answer? contact us directly to get an explanation for this answerfish crab dolphin whale starfish