๐Map
๐ง under construction
breadcrumb ๐ง
Map
is iterable.
is a data structure.
is a better alternative for associated array.
้็ถ Object ่ Map ้ฝๆฏ JS ็จไพๅฏฆ็พ Dictionary ็ๆนๆณ๏ผไฝๅฎๅๅญๅจๅบๆฌ็ไธๅ้ปใ
Maps vs. Objects
feature
Map
Object
โ use [...map] to convert into Array.
โ for(const [key, value] of map){...}
โ for(const key of map.keys()){...}
โ for(const value of map.values()){...}
โ map.forEach((value, key) => {...})
โ does not implement iteration protocol.
โ not directly iterable using for...of.
โญ can use for...in to iterate over enumerable properties.
keys
can be any value (including functions, objects, or any primitive).
Map โ Array
Other Topics
Last updated