偽數組:不能調用數組的方法,
1.對象是按索引方式存儲數據的 2.它具備length屬性 {0:'a',1:'b',length:2}
//es5偽數組轉換成數組
let args = [].slice.call(arguments) //collection
let imgs = [].call(document.querySelectorAll('img')) // NodeList
//es6偽數組轉換成數組
let args = Array.from(arguments)
let imgs = Array.from(document.querySelectorAll('img'))
Array.from還具備遍歷的功能
初始化一個長度為5,並填充每個元素為1的數組
let array = Array.from({length:5},function(){return 1})