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);
});
31k questions
32.8k answers
501 comments
693 users