一:什么是偽數(shù)組
1:具有l(wèi)ength屬性
2:不具有數(shù)組的方法
3:按索引方式存儲(chǔ)數(shù)據(jù)
用一句話(huà)來(lái)說(shuō):無(wú)法直接調(diào)用數(shù)組方法或期望length屬性有什么行為 不具有數(shù)組的方法 但仍可以用數(shù)組遍歷方法遍歷
二:常見(jiàn)的偽數(shù)組有哪些
1:function里的arguments
2:通過(guò)getElementByTagName(),document.childNodes(),getElementByName(),document.children()等方式獲取的NodeList集合的對(duì)象都屬于偽數(shù)組
3:特殊寫(xiě)法的對(duì)象
eg: var obj={}
obj[0]="一"? obj[1]="二"? obj[2]="三"
三:將偽數(shù)組轉(zhuǎn)化為標(biāo)準(zhǔn)數(shù)組的方法
Arry.prototype.slice.call(偽數(shù)組)
eg:Array.prototype.slice.call(arguments) 將arguments轉(zhuǎn)化為真正數(shù)組