$(document).ready(initPage);
function initPage() {
alert((8).double1.square);//256
//也可以这样写
alert(8["double1"]["square"])
// 256
}
Number.prototype = Object.defineProperty(
Number.prototype, "double1", {
get: function (){return (this + this)}
}
);
Number.prototype = Object.defineProperty(
Number.prototype, "square", {
get: function (){return (this * this)}
}
);
js 灵活写法
最新推荐文章于 2023-04-10 17:13:23 发布