In Javascript, Function.call()
can call Function
given a this
value and zero or more arguments.
Function.call
itself is a function. So in theory, Function.call
should be the same (or similarly acting) function as Function.call.call
.
In V8, this seems to be the case:
> Function.call === Function.call.call
true
When we call Function.call()
, we get an anonymous function
> Function.call()
[Function: anonymous]
However, I can't call .call()
on Function.call
.
> Function.call.call()
TypeError: undefined is not a function
at repl:1:21
at REPLServer.defaultEval (repl.js:132:27)
at bound (domain.js:291:14)
at REPLServer.runBound [as eval] (domain.js:304:12)
at REPLServer.<anonymous> (repl.js:279:12)
at REPLServer.emit (events.js:107:17)
at REPLServer.Interface._onLine (readline.js:214:10)
at REPLServer.Interface._line (readline.js:553:8)
at REPLServer.Interface._ttyWrite (readline.js:830:14)
at ReadStream.onkeypress (readline.js:109:10)
What is going on here? Function.call
is clearly a function - it's not undefined
as this error message suggests.