ES6重要点学习
1.解析赋值:
let [a,b,c,d,e] = '我是中国人' //我 a = wo
let [a,b,c] = 123 // 出错,Numberbu不允许解析不允许解析
2.数据集合Set, map:
let map = new Map()
console.log(map)
const map1 = new Map([
[’name’,‘zhangsan’],
[‘age’, 17],
[’sex’, ‘男']
]);
![](https://images2017.cnblogs.com/blog/804440/201710/804440-20171029185845039-634243413.png)
map和set都可以用来去重。
map的遍历:
map.forEach(function (value, index) {
console.log(index)
console.log(value)
})
注意事项:这里是两个对象。
map.set({}, ‘111’);
map.set({}, ‘222’);
3.symbol:
![](https://images2017.cnblogs.com/blog/804440/201710/804440-20171029185936195-1599042990.png)
解决命名冲突:
![](https://images2017.cnblogs.com/blog/804440/201710/804440-20171029185946148-1715668195.png)