Loop through an array in JavaScript
Asked 07 September, 2021
Viewed 409 times
  • 58
Votes

In Java you can use a for loop to traverse objects in an array as follows:

String[] myStringArray = {"Hello", "World"};
for (String s : myStringArray)
{
    // Do something
}

Can you do the same in JavaScript?

30 Answer