let that= [];
function Hero(name,hp){
this.name = name;
this.hp = hp;
that.push(this);
}
console.log(Hero.prototype);
Hero.prototype.atk = function (){
that.push(this);
console.log(`${this.name}体力是${this.hp}.`);
}
const liubei = new Hero('刘备',78);
const guanyu = new Hero('关羽',98);
const zhangfei = new Hero('张飞',98);
liubei.atk();
guanyu.atk();
zhangfei.atk();
console.log(that[3] === liubei);
console.log(that[4] === guanyu);
console.log(that[5] === zhangfei);
console.log(liubei.atk === guanyu.atk);