如何理解Array.apply(null, {length:5})的{length:5}?
我测试过
Array.apply(null, {length:5}) //返回[undefined, undefined, undefined, undefined, undefined]
Array.apply(null, [{length:5}])和Array({length:5})返回的结果是一样的,为
[[object Object] {
length: 5
}]
第二、三还能理解!第一种怎么理解?
和ES6的
Array.from
有点类似, Array.from一周热门 更多>