给定一个任意的javascript对象,我怎样才能找到它的方法?

问题描述:

我知道这在python中是可行的,但是我可以获得javascript对象的方法列表吗?

I know this is possible in python, but can i get a list of methods for a javascript object?

你可以遍历对象中的属性并测试它们的类型。

You can loop over the properties in the object and test their type.

for(var prop in whatever) {
    if(typeof whatever[prop] == 'function') {
        //do something
    }
}