P
pedz
This message started off with the following question:
I now see how/where/why it does. [ 1, 2, 3] is a call to new Array()
and since Array is itself a function object (I guess), [[HasInstance]]
is inherited from Array. Can someone give me an example of something,
f, where typeof(f) would return "object" but f is not a function
object? Or, to ask it another way, is "function object" essentially
the same as "object" ?
Confused...
In the ECMA spec, instanceof depends upon [[HasInstance]] but [[HasInstance]] is only defined for Function
Objects. Why does:
[ 1, 2, 3 ] instanceof Array
not throw a TypeError as specified in step 6 of [1]?
[1] http://es5.github.com/#x11.8.6
How / where / why does Array get a [[HasInstance]] internal method? How is that method defined?
I now see how/where/why it does. [ 1, 2, 3] is a call to new Array()
and since Array is itself a function object (I guess), [[HasInstance]]
is inherited from Array. Can someone give me an example of something,
f, where typeof(f) would return "object" but f is not a function
object? Or, to ask it another way, is "function object" essentially
the same as "object" ?
Confused...