📅  最后修改于: 2020-10-25 04:42:51             🧑  作者: Mango
JavaScript Map对象用于将键映射到值。它将每个元素存储为键值对。它根据指定的键操作诸如搜索,更新和删除之类的元素。
new Map([iterable])
可迭代-表示数组和其他可迭代对象,其元素为键值对形式。
让我们看一下JavaScript映射方法及其说明的列表。
Methods | Description |
---|---|
clear() | It removes all the elements from a Map object. |
delete() | It deletes the specified element from a Map object. |
entries() | It returns an object of Map iterator that contains the key-value pair for each element. |
forEach() | It executes the specified function once for each key/value pair. |
get() | It returns the value of specified key. |
has() | It indicates whether the map object contains the specified key element. |
keys() | It returns an object of Map iterator that contains the keys for each element. |
set() | It adds or updates the key-value pairs to Map object. |
values() | It returns an object of Map iterator that contains the values for each element. |