Source: How to loop through array in jQuery?
javaScript
1 2 3 4 |
var i; for (i = 0; i < substr.length; ++i) { // do something with `substr[i]` } |
jQuery
1 2 3 |
jQuery.each(substr, function(index, item) { // do something with `item` (or `this` is also `item` if you like) }); |
ES5
1 2 3 |
substr.forEach(function(item) { // do something with `item` }); |