Answers for "can i use map inside for loop"

1

use of map instad of for loop

for i in object:
     doSomething(i)
////////////////////////////////
map(doSomething, object)
Posted by: Guest on April-07-2021
0

how to loop through a map in js

var myMap = new Map();
myMap.set("0", "foo");
myMap.set(1, "bar");
myMap.set({}, "baz");

for (const [key, value] of Object.entries(myMap)) {
  console.log(key, value);
}
Posted by: Guest on May-12-2021

Code answers related to "can i use map inside for loop"

Code answers related to "Swift"

Browse Popular Code Answers by Language