Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Javascript or Jquery loop iterations, Different type of loop iterations.
var arrayCollection = [“ABC”, “DEF”, “HIJ”];
$.each(arrayCollection, function(index, value){
console.log(“index : ,index, value :, value);
});
$(arrayCollection).each(function(index, value){
console.log(“index : ,index, value :, value);
});
for(var i = 0; i < arrayCollection.length; i++) {
console.log(“index : , i , value :, arrayCollection[i]);
}
$.map(arrayCollection, function( val, i ) {
console.log(“index : , i , value :, val);
});
arrayCollection.map((val, i ) => console.log(“index : , i , value :, val));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment