Getting supported methods of objects

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian

    Getting supported methods of objects

    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
  • Lasse Reichstein Nielsen

    #2
    Re: Getting supported methods of objects

    genisiob@pilot. msu.edu (Brian) writes:
    [color=blue]
    > 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) )[/color]

    .... 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.
    [color=blue]
    > but, is there something similar for getting all of the methods?[/color]

    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
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    Working...