SOURCE

class Letter{
    constructor(name){
        this.name = name
    }
}

//暗恋人小明
let xiaoMing = {
    name:'小明',
    sendLetter(target){
        target.receiveLetter(this.name)
    }
}
//代理小花
let xiaoHua = {
    receiveLetter(customer){
        // // 当然要等小红好心情时才送情书,也在送情书也才创建情书
        xiaoHong.listenGoodMood(()=>{
            xiaoHong.receiveLetter(new Letter(customer + '的情书'))
        })
    }
}
//小红
let xiaoHong ={
    name:'小红',
    receiveLetter(letter){
        console.log(this.name + "收到" + letter.name)
    },
    listenGoodMood(fn){
        setTimeout(()=>{
            fn()
        },1000)
    }
}
xiaoMing.sendLetter(xiaoHua) ////小红收到:小明的情书


const scoreList = { wang: 90, li: 60, wu: 100 };
const yyProxy = new Proxy(scoreList, {
  get: function (scoreList, name) {
    if (scoreList[name] > 69) {
      console.log('输出成绩');
      return scoreList[name];
    } else {
      console.log('不及格的成绩无法公示');
    }
  },
  set: function (scoreList, name, val) {
    if (val - scoreList[name] > 10) {
      console.log('修改成绩');
      scoreList[name] = val;
    } else {
      console.log('无法修改成绩');
    }
  },
});
yyProxy['wang'] = 98; //无法修改成绩
yyProxy['li'] = 80; //修改成绩
console 命令行工具 X clear

                    
>
console