콘솔에 인스턴스.heal = 50; 이라고 치면 왜 60 이라고 나오나요?ㅠㅠ..
<script>
class Unit{
constructor(){
this.power = 5;
this.health = 100;
}
get battlePoint(){
return this.power + this.health
}
set heal(a){
this.health = this.power + a;
}
};
var 인스턴스 = new Unit();
console.log(인스턴스.battlePoint);
인스턴스.heal = 50;
</script>