javascript iterating over map code example
Example 1: iterate over map key value javascript
recipeMap.forEach((value, key) => {
console.log(`${key} costs ${value}`);
});
Example 2: use map to loop through an array
let squares = [1,2,3,4].map(function (val) {
return val * val;
});
// squares will be equal to [1, 4, 9, 16]
Example 3: iteratea on values map js
map.values((value) => /* do whatever with value */)