How can I find the prototype methods (not PrototypeJS) that have been defined using reflection? Also, how to find all defined objects and methods in the global scope?
the for...in
travels all the way down the prototype chain, it doesn't garauntee any specific order, but it should loop through all the properties you're looking for...
for ( var property in obj ) {
//obj[property];
}
If you are looking for only inherited (via prototype) members, add a hasOwnProperty()
check...
for ( var property in obj ) {
if ( ! obj.hasOwnProperty(property) ) {
//obj[property] is an inherited property...
}
}
also, I've never tried this but, but using window
, I believe you'd find what you are looking for...
for ( var property in window) {
//window[property];
}