一.類型
1. arguments并不是數組,而是一個類數組對象,它包含length屬性。我們可以通過Array.prototype.slice.call(arguments)將獲取對應真實數組。
arguments?instanceof?Array?//false
arguments?instanceof?Object?//true
2. rest是一個真實數組。
rest?instanceof?Array?//true
3. 萬物皆對象。
rest?instanceof?Object?//true
Array?instanceof?Object?//true
二.參數
1. arguments是參數的類數組化表現,它包含所有可用參數。
2. rest是非定義的多余變量數組。
function?Test(x,?...rest){
????arguments.length;?//3
????rest.length;?//2
}
Test(1,?2,?3);