Getting supported methods of objects

B

Brian

Hello,

I am working on a utility script to browse the supported objects in a
browser. I know I can get the object members, by:

for( member in eval(obj_name) )

but, is there something similar for getting all of the methods?

Thanks,
Brian
 
L

Lasse Reichstein Nielsen

I am working on a utility script to browse the supported objects in a
browser. I know I can get the object members, by:

for( member in eval(obj_name) )

.... but you shoudn't use eval like that. If obj_name contains the name
of a global variable, just write "window[obj_name]". If nothing else,
it is probably orders of magnitude faster that using eval.
but, is there something similar for getting all of the methods?

There is no difference between "members" and "methods" in Javascript.
They are all object properties. The for(..in..) construction iterates
throught all the *enumerable* properties. There is no easy way to find
the names of non-enumerable properties (like all the properties of
the array prototype). So, no.


/L
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top