Hi, The `for..in` loop enumerates the *names* of the properties in the object and its prototype(s); your `m` is always a string because property names are always strings. To get the property value, just look it up as normal:
for (name in c) { console.log(name + " [" + typeof c[name] + "]"); } (Or instead of `typeof` you have other options[1], but you get the idea.) As a bonus answer, if you want to differentiate between properties on the object itself and properties that it's inheriting from its prototype chain, use `hasOwnProperty`: for (name in c) { console.log( name + " [" + typeof c[name] + "] (" + (c.hasOwnProperty(name) ? "own" : "inherited") + ")" ); } Live example: http://jsbin.com/ekimu4 [1] http://blog.niftysnippets.org/2010/09/say-what.html HTH, -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Mar 17, 4:53 pm, greg <g...@reservation-net.com> wrote: > Hi, > > Within my script I'd like to get a list of methods defined within in a > class created with Class.create(). > > If I do: > var c = new MyShinyNewClass() > console.log(c) > I get a nice breakdown of variables and methods, and firebug > differentiates the vars from the functions. > > If I do: > for (m in c) console.log(m) > I get a nice list of all variables and methods, but typeof m always > returns 'string'. > > Given that firebug can differentiate between a variable and function, > is there any way for me to do the same? > > Thanks. -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.