[Proto-Scripty] Re: Finding Class methods

2011-03-18 Thread greg
Doh! Thank you folks for pointing out the astonishingly simple answer. Sometimes I'm so stunned when something doesn't work, I don't see the obvious. -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send em

[Proto-Scripty] Re: Finding Class methods

2011-03-18 Thread T.J. Crowder
> Try console.log(typeof c.m) That will look up a property "m" on the `c` object. You mean: console.log(typeof c[m]); ...which will look up a property using the name contained by the `m` variable, rather than the property with the name "m". -- T.J. ;-) On Mar 18, 7:19 am, mmerlin wrote: > gre

[Proto-Scripty] Re: Finding Class methods

2011-03-18 Thread mmerlin
greg, Nothing to do with Prototype. Standard javascript / DOM > 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'. for (a in b) always sets 'a' to be a string. It is the 'name' of the property in 'b'. Try console.l

[Proto-Scripty] Re: Finding Class methods

2011-03-18 Thread T.J. Crowder
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] + "]"); }