@windchimes
2019-06-25T09:07:08.000000Z
字数 417
阅读 276
js
es7新增加了两个新属性:
1)Array.prototype.includes
let arr = [1,2,3,4];arr.includes(2) //true
2)幂运算 **
let a = 2;console.log(a**3) //8
es8新增的属性有:
1)允许结尾逗号
let obj = {a,b,c,}
2)Object.entries Object.values
Object.entries({foo:1,bar:2}) // [['foo':1],['bar':2]]Object.values({foo:1,bar:2}) // [1,2]
3)字符串填充 padStart padEnd trimStart trimEend
console.log('testing'.padStart(12).length) //' testing'console.log('testing).padStart(12, '_') //'______testing'
