Back
How can I loop through all the entries in an array using JavaScript?
I thought it was something like this:
forEach(instance in theArray)
Where theArray is my array, but this seems to be incorrect.
With the release of ES5 the forEach was also released so you can use forEach to loop over the array as follows:-
var abc = ["a", "b", "c"]; abc.forEach(function(entry) { console.log(entry); });
var abc = ["a", "b", "c"];
abc.forEach(function(entry) {
console.log(entry);
});
30.9k questions
32.9k answers
500 comments
665 users