ES6 Map All In One
ES6 Map All In One
Map 字典/地图
Set 集合
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
Map with initializing
initial value
// ✅ 二维数组,作为初始值
const map = new Map([["(", ")"]]);
// Map(1) {"(" => ")"}
const map = new Map(["(", ")"]);
// ❌ Uncaught TypeError: Iterator value ( is not an entry object at new Map (<anonymous>)
const map = new Map({"(": ")"});
// ❌ Uncaught TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator))
refs
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/13995530.html
未经授权禁止转载,违者必究!