Number.call.call(Number, undefined, 0)
evaluates to 0
. Let's break down why:
-
Number.call
:call
is a method available on all functions.Number.call
refers to thecall
method of theNumber
constructor function. Remember,Number
itself is a function that can be used to convert values to numbers. -
.call(Number, undefined, 0)
: Here, we're usingcall
again, but this time on thecall
method itself. The first argument tocall
sets thethis
value of the function being called. In this case, we're setting thethis
value toNumber
. The subsequent arguments (undefined
,0
) become the arguments passed to the function being called. -
Putting it together: We're essentially calling
Number(undefined, 0)
withNumber
as its ownthis
value. TheNumber
constructor, when called withundefined
or no arguments, returns0
. The second argument,0
in this case, is ignored becauseNumber
only takes one argument.
Therefore, the entire expression simplifies to Number(undefined)
which results in 0
.