阅读背景:

我怎样才能得到安慰呢?将日志输出getter结果而不是字符串“[getter /Setter]”?

来源:互联网 

In this code:

在这段代码中:

function Cls() {
    this._id = 0;
    Object.defineProperty(this, 'id', {
        get: function() {
            return this._id;
        },
        set: function(id) {
            this._id = id;
        },
        enumerable: true
    });
};
var obj = new Cls();
obj.id = 123;
console.log(obj);
console.log(obj.id);
function Cls() {
    



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: