1var myMap = new Map();
2myMap.set("0", "foo");
3myMap.set(1, "bar");
4myMap.set({}, "baz");
5
6for (const [key, value] of myMap.entries()) {
7 console.log(key, value);
8}
1const object = {'a': 1, 'b': 2, 'c' : 3};
2for (const [key, value] of Object.entries(object)) {
3 console.log(key, value);
4}
1let squares = [1,2,3,4].map(function (val) {
2 return val * val;
3});
4// squares will be equal to [1, 4, 9, 16]