constructor vs typeof
constructor vs typeof
Hi Team
I've been wondering, why is that x.constructor == y is always used
instead of typeof ?
Is this a speed, size or browser quirks optimization ?
I personally prefer typeof, the contructor requires one to first check
that x isn't null. Also, referring to String, Array.. etc should be
slow as they're properties of window and the interpreter needs to
lookup for them on each scope in the chain before finding them.
Just being curious :)
Cheers
--
Ariel Flesler
http://flesler.blogspot.com