在javascript中获得一个对象的所有方法

Object.getOwnPropertyNames(Object.prototype)
Object.getOwnPropertyNames(Object)

以下是在firebug上运行的结果:

Object.getOwnPropertyNames(Object.prototype)

[“constructor”,
“toSource”,
“toString”,
“toLocaleString”,
“valueOf”,
“watch”,
“unwatch”,
“hasOwnProperty”,
“isPrototypeOf”,
“propertyIsEnumerable”,
defineGetter“,
defineSetter“,
lookupGetter“,
lookupSetter“]

Object.getOwnPropertyNames(Object)
[“prototype”,
“getPrototypeOf”,
“getOwnPropertyDescriptor”,
“keys”,
“is”,
“defineProperty”,
“defineProperties”,
“create”,
“getOwnPropertyNames”,
“isExtensible”,
“preventExtensions”,
“freeze”,
“isFrozen”,
“seal”,
“isSealed”,
“length”,
“name”,
“arguments”,
“caller”]