Yes you are right, shortly after posting I thought exactly that, I
feel incredibly stupid

On Feb 8, 4:01 am, "T.J. Crowder" <[email protected]> wrote:
> Hi,
>
> You're going to laugh. You want the `instanceof` operator[1]:
>
>     if (bar instanceof Foo) { ... }
>
> [1]https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Operat...
>
> HTH,
> --
> T.J. Crowder
> Independent Software Consultant
> tj / crowder software / comwww.crowdersoftware.com
>
> On Feb 7, 7:38 pm, Don <[email protected]> wrote:
>
> > Is there a way to check if an instance is a specified class?  For
> > example,
>
> > var Foo = Class.create({});
> > var bar = new Foo();
> > if (Object.isType(Foo, bar)) {
> >   //bar is an instance of Foo} else {
>
> >   // bar is NOT an instance of Foo
>
> > }
>
> > I know that in this case bar would always be an instance of Foo, but
> > generally is there a way to check?

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to