call: The first one is to directly pass the object in;
apply: The second one is treated as an array with an array length of 3, but there is no value, so undefined {length: 3} => {length: 3, 0: undefined, 1: undefined, 2: undefined } So Output 3 undefined
Write it here for easy reading.
call:
The first one is to directly pass the object in;
apply:
The second one is treated as an array with an array length of 3, but there is no value, so undefined
{length: 3} => {length: 3, 0: undefined, 1: undefined, 2: undefined }
So Output 3 undefined
call accepts continuous parameters, and apply accepts array parameters.
A.call(this, a,b,c,d)
A.apply(this, [a,b,c,d])
The second parameter of the call() method is an item in the array,
The second parameter of the apply() method is an array