When it comes to writing jQuery-based JavaScript, there are generally two camps of people:
- Those who believe that you should intermingle jQuery with vanilla JavaScript for when you need it
- Those who believe that if you’re importing jQuery, then you should use it as much as possible
Both camps have their own sets of arguments neither of which I’m looking to explore in this particular post; however, one of the features that’s all too common is having to loop through a vanilla array using JavaScript.
The two main ways that you can do about doing this are to use a standard for, while, or do loop or use jQuery’s iterator.
If you fall into the former camp, but are looking to use an iterator, here’s how you can begin looping through an array with jQuery.

