Use the instanceOf() static method on the org.mozilla.javascript.ScriptRuntime class.

Attila.

On 2009.02.24., at 6:09, rhtdm48 wrote:

thanx it is useful too.

But I want to know when we will evaluate a javascript file in java it
will return person1 object as a scriptable object we can call this
object or any of its method in its prototype chain but how we will
know that this is an object of person class in java side....

On Feb 23, 6:29 pm, Attila Szegedi <[email protected]> wrote:
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....

Attila.

--
home: http://www.szegedi.org
twitter: http://twitter.com/szegedi
weblog: http://constc.blogspot.com





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

Reply via email to