JavaScript also has an "instanceof" operator, so you can use:

if(person1 instanceof person)

In JavaScript "x instanceof y" returns true if y.prototype is found in the prototype chain of x.

Attila.

On 2009.02.23., at 14:11, rhtdm48 wrote:

Hey can ne one tell me how to find out that an object belongs to which
calss in javascript

Like
we have a person class in javascript:
     var person=function(){
                                         /*somecode*/
                      }
    person.prototype={
                                      /*somecode*/
                              }

we create an object of this class
 var person1=new person();

we can get the id "person1" in java using rhino
but how to find out person1 is an object of person class

can neone tell me ????

thnx in advance....
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to