javascript - How to get an object's methods? -


is there method or propertie methods object? example:

function foo() {} foo.prototype.a = function() {} foo.prototype.b = function() {}  foo.get_methods(); // returns ['a', 'b']; 

update: there method in jquery?

thank you.

function getmethods(obj) {     var res = [];     for(var m in obj) {         if(typeof obj[m] == "function") {             res.push(m)         }     }     return res; } 

Comments