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);
}
}
}