@bushbass/Simple forEach example part 2
JavaScript

part 2 which iterates over objects

const each = function(collection, iterator) { 
  for (let key in collection) { 
    iterator(collection[key], key, collection) ;
  }
};

each({1:'one', 2:'two', 3:'three', 4:'four', 5:'five'}, (item,index) => console.log(`value = ${item} : key =  ${index}`));
Native Browser JavaScript