字符串的扩大办法:

const message = 'Error:foo is not defined .'; console.log(    //  message.startsWith('Error')    //  message.endsWith('.')    message.includes('foo') )

对象的字面量增强:

能够在[]中输出任意的变量或者表达式来设置对象的属性名

Set数据结构是一个汇合,不能有反复

const s = new Set(); s.add(1).add(2).add(3) s.forEach(i=>console.log(i)) for(let i of s){     console.log(i) } console.log(s.size) //数组去重 const arr = [1,2,3,4,5,5,6]; const result = Array.from(new Set(arr)); console.log(result)

Map数据结构能够用任意类型作为键,而对象只能用字符串作为键

const m = new Map(); const tom = {name:"tom"}; m.set(tom,90) console.log(m) console.log(m.get(tom))

Symbo:
1.防止对象属性名的反复
2.用来创立公有成员的属性名

const name = Symbol();const person = {    [name]:"zsd",    say(){        console.log(this[name])    }}person.say()

最次要的作用就是为对象增加举世无双的属性名

如何创立一个雷同的Symbo?

const s1 = Symbol.for('foo');const s2 = Symbol.for('foo');console.log(s1===s2)//true

想要获取对象外面的Symbo属性名,只能用Object.getOwnPropertySymbols(obj);除此之外,Object.key(obj)和 for in 和JSON.stringify(obj)都不行

生成器generator:能够用生成器去写一个迭代器,达到对立解决任何数据结构的遍历