阅读背景:

使用Revealing Module Pattern,为什么这个对象会改变?

来源:互联网 

Given the following code:

给出以下代码:

var House = function(x, y) {
    var _posX;
    var _posY;

    function init(x,y) {
        _posX = x;
        _posY = y;
    }

    // Auto init
    init(x, y);


    // Public
    return {
        posX: _posX,
        posY: _posY,

        setPosition: function(x, y) {
            _posX = x;
            _posY = y;
        }
    };
};
var House



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

分享到: