Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

BobbyTanomred's avatar

For-each over an array in JavaScript

How can I loop through all the entries in an array using JavaScript?

0 likes
3 replies
gty's avatar

Use the forEach() function on the array:

const fruits = ["apple", "orange", "cherry"];
fruits.forEach(myFunction);

Please or to participate in this conversation.