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

Reply via email to