JQuery Loop sobre elementos
$( "li" ).each(function( index ) {
console.log( index + ": " + $( this ).text() );
});
Lonely Curly Boi
$( "li" ).each(function( index ) {
console.log( index + ": " + $( this ).text() );
});
const array1 = ['a', 'b', 'c'];
array1.forEach(element => console.log(element));
// expected output: "a"
// expected output: "b"
// expected output: "c"
function each(coll, func) {
if (Array.isArray(coll)) {
for (var i = 0; i < coll.length; i++) {
func(coll[i], i);
}
} else {
for (var key in coll) {
func(coll[key], key);
}
}
}