1 回答

TA貢獻1744條經驗 獲得超4個贊
Syntax
fun.apply(thisArg, [argsArray])
Parameters
thisArg
The value of this provided for the call to fun. Note that this may not be the actual value seen by the method: if the method is a function in non-strict mode code, null and undefined will be replaced with the global object, and primitive values will be boxed.
argsArray
An array-like object, specifying the arguments with which fun should be called, or null or undefined if no arguments should be provided to the function. Starting with ECMAScript 5 these arguments can be a generic array-like object instead of an array. See below for browser compatibility information.
從es5開始支持array-like的object啦,所有array-like就是有length屬性,有index作為key的object啦。
你這個object正巧就有length屬性,不過沒有鍵值對,所以遍歷出5個undefined
添加回答
舉報