[Javascript] Function.prototype.call

.callmethod exits on any function, which will refer to Function.prototype.call

for example:

console.log.call === Function.prototype.call // call

 

Also it means that

Function.prototype.call === Function.prototype.call.call

 

Question:

console.log.call.call.call.call.call.apply(a => a, [1, 2]) // ?

the same as:

Function.prototype.call.apply(a => a, [1, 2])

the same as: thisPointer.method(params), and thisPointeris a => amethodis .call

(a => a).call(1, 2)

So the result is 2

posted @ 2024-09-09 14:52  Zhentiw  阅读(13)  评论(0)    收藏  举报