Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #loop #map #js
ADD COMMENT
Topic
Name
6+3 =