Javascript instanceof WHATEVER

By Luke Smith on November 8, 2007 9:38 AM

Pointless revelation of the morning:

function Foo() {}
var fooInstance = new Foo();

var Bar = Foo;
var Baz = Bar;

if (fooInstance instanceof Foo) {} // true
if (fooInstance instanceof Bar) {} // true
if (fooInstance instanceof Baz) {} // true

Not that this is particularly helpful in any way, but interesting enough to a groggy morning brain (it doesn't take much).

No TrackBacks (http://lucassmith.name/mt/mt-tb.cgi/96)

ls.n

LucasSmith.name

Luke and Heidi

I'm Luke. I am a front end engineer at Yahoo! on the YUI team.

Mostly I write about code stuff, but occassionally I'll mix in some real life. You've been warned.

Archives

Tags

Feeds

Subscribe to feed Recent entries

Content licensed under Creative Commons

Code licensed under BSD license

©2005 - 2010 Lucas Smith

Powered by Movable Type