N
const avengers = ['thor', 'captain america', 'hulk'];
avengers.forEach((item, index)=>{
console.log(index, item)
})
N
var colors = ['red', 'blue', 'green'];
colors.forEach(function(color) {
console.log(color);
});
N
const fruits = ['mango', 'papaya', 'pineapple', 'apple'];
// Iterate over fruits below
// Normal way
fruits.forEach(function(fruit){
console.log('I want to eat a ' + fruit)
});
N
//Array
$.each( arr, function( index, value ){
sum += value;
});
//Object
$.each( obj, function( key, value ) {
sum += value;
});
N
$.each( obj, function( key, value ) {
alert( key + ": " + value );
});
N
$('.testimonial').each(function(i, obj) {
//test
});