Level 1
Use the forEach() function on the array:
const fruits = ["apple", "orange", "cherry"];
fruits.forEach(myFunction);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
How can I loop through all the entries in an array using JavaScript?
Please or to participate in this conversation.