1024程序节老婆高光时刻

994 阅读1分钟

背景 2020 - 1024 = 996 = 1 + 1 +1

(function(){
	function Wife(){
    this.name = "zyonger";
    this.age = 32;
    this.birthPlace = "湖南省邵阳市隆回县";
    this.childrens = 2;
    this.son = 0;
    this.sonName = "";
    this.girl = 2;
}

Wife.prototype.produce = function(){
    this.childrens ++;
    this.son = 1;
}
const myWife = new Wife();
const timer = setInterval(() => {
    const date = new Date();
    const y = date.getFullYear();
    const m = date.getMonth() + 1;
    const d = date.getDate();
    const str = y + "." + m + "." + d;
    if(str === '2020.10.24'){
      myWife.produce();
      clearInterval(timer)
    }
}, 1000*60);
// how to give a name ?
function _giveAName(name){
   myWife.sonName = name;
}

globalThis.giveAName = _giveAName;

})(globalThis)

外部调用传name

globalThis.giveAName()