Right... I thought I just said there was an instanceof operator in my post just before yours in this thread. I know it works in IE, not sure about the other browsers.

And as for that link about subclassing... Sorry, it's just that, well, this is the prototype/scriptaculous mailing list, and that link seems to be a few years old and a few dollars short. Prototype.js gives all the facilities mentioned in that article, and quite a bit more. Do you not use protoype?


On 6/8/06, Andrew Tetlaw < [EMAIL PROTECTED]> wrote:
There is the instanceof operator.

function MyClass() {}

var x = new MyClass();

alert(x instanceof MyClass);

As for subclassing see this: http://_javascript_.crockford.com/inheritance.html


On 08/06/06, Gregory Hill <[EMAIL PROTECTED]> wrote:
>
>
>
>
> Not as far as I know.  I think only built-ins can have a different type
> value, but I could be wrong.
>
>
>
> Would be nice if _javascript_ supported true subclassing, but I don't believe
> it does.
>
>
>
> Greg
>
>
>
>
>  ________________________________
>
>
> From: [EMAIL PROTECTED]
> [mailto: [EMAIL PROTECTED]] On
> Behalf Of Casey O'Neill
>  Sent: Wednesday, June 07, 2006 1:54 PM
>  To: [email protected]
>  Subject: [Rails-spinoffs] Determining the type of an object
>
>
>
>
> How do you determine the type of a prototype object? I have a hashmap that
> was created using $H().
>
>  var temp = new $H();
>
>  typeof temp: "object"
>  temp.constructor (): [object Object]
>
>  I know the the $H() is initially created by extending object but is there
> anyway to figure out if the temp object is of type Hash? Of course, this is
> aside from evaluating the existence of temp.values ().
>
> _______________________________________________
> Rails-spinoffs mailing list
> [email protected]
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
>
>


--
Andrew Tetlaw
htp://tetlaw.id.au
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to