📅  最后修改于: 2022-03-11 15:01:07.729000             🧑  作者: Mango
Object.prototype.can = function(methodName)
{
return ((typeof this[methodName]) == "function");
};
if (someObject.can("quack"))
{
someObject.quack();
}