Last active
September 2, 2019 07:08
-
-
Save ankitkanojia/45b77262bfe939984d3a31379ad9d926 to your computer and use it in GitHub Desktop.
Javascript or Jquery loop iterations, Different type of loop iterations.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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