SOURCE

function Deng (name, wife) {
    var prepareWife = 'xiaozhang'; // 私有化变量
    this.name = name;
    this.wife = wife;
    this.divorce = function () {
        this.wife = prepareWife;
    }
    this.changePrepareWife = function (target) {
        prepareWife = target;
    }
    this.sayPrepareWife = function () {
        console.log(prepareWife)
    }
}
var deng = new Deng('deng', 'xiaoliu')
console.log(deng.prepareWifepre)
console.log(deng.sayPrepareWife());
console 命令行工具 X clear

                    
>
console