js 给 对象添加扩展方法
像c# 那样 点出来 ,而不是 函数 括号包着 , 比如 想给所有 Object 添加一个 isSuccess 方法 ,可以 这样写
// js 给 object 添加 扩展方法
Object.defineProperty(Object.prototype, "isSuccess", {
value: function isSuccess() {
return this.resultCode === "1";
},
writable: true,
configurable: true
})

浙公网安备 33010602011771号