Combining typeof and instanceof

Andrea Giammarchi andrea.giammarchi at
Sun Feb 3 15:09:59 PST 2013

you should link "Have you met Empty?" entry there:

It explains why typeof null is object, and provides more insights about the
Empty constructor and the root of JS inheritance.

Said that, the difference between is_type, is_a (is_instance), and
responds_to(BehaviorObject) from Ruby, is kinda important. Back to good old
cross frame problem when an Array.prototype could be polluted in frame-x
but not on top, isInstance(arrayFromFrame, Array) will fail there and this
is both expected behavior, and correct, IMHO.

Any attempt to clarify type and instances will result in more confusion,
same confusion has TypeScript between val:string and val:String, either
there is a rule about checking the class name or its symbol with an
operator or something will be ambiguous anyhow.

My 2 cents

On Sun, Feb 3, 2013 at 1:14 PM, Axel Rauschmayer <axel at> wrote:

> It has always bothered me that one had to distinguish primitives and
> objects if one wanted to categorize values in JavaScript. The following is
> a proposal for changing that:
> Comments and suggestions welcome.
> --
> Dr. Axel Rauschmayer
> axel at
> home:
> twitter:
> blog:
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list