SOURCE

function Archiver() {
  
  var archive = [2];

  Object.defineProperty(this, 'archive', {
    get: function() {
      console.log('get!');
      return archive;
     
    },
    set: function(value) {
      console.log('set!');
    
    }
  });
}

var arc = new Archiver();
console.log(arc.archive);

console.log('-----以下不触发set(理解为指针未发生指向变动)----');
arc.archive[0] =9;

console.log('===以下触发set====');
arc.archive =[5,6];
console 命令行工具 X clear

                    
>
console