ES6新特性七:数组的扩充详解(2)

console.log(Array.from(['a',,'b']))//[ 'a', undefined, 'b' ] console.log([...['a',,'b']])// [ "a", undefined, "b" ] let arr = [, 'a',,]; for (let i of arr) { console.log(i); }//undefined a undefined

// entries() [...[,'a'].entries()] // [[0,undefined], [1,"a"]] // keys() [...[,'a'].keys()] // [0,1] // values() [...[,'a'].values()] // [undefined,"a"] // find() [,'a'].find(x => true) // undefined // findIndex() [,'a'].findIndex(x => true) // 0

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wypfgx.html