Object.defineProperties(Number.prototype, {
obj: {
get: function () { return { add: p => this + p } }
},
add: { value: function (p) { return this + p } }
});
console.log((1).obj.add(5),(1).add(10))
JavaScript在原型上定义属性
猜你喜欢
转载自blog.csdn.net/slwsss/article/details/97888338
今日推荐
周排行