asked
[Renewal] Introduction to JavaScript in Zero Seconds through Coding Self-Study
Self Check - Making a Computer That Pretends to Think
Written on
·
220
0
onBattleMenuInput 메소드에서
const { hero, monster } = this; 으로 구조분해 하였는데
hero.getXp(monster.xp) 부분은 this없이 사용이 가능한데
this.monster = null 부분은 왜 this 빼면 오류가 발생하나요?
Answer 1
const a = { hello: 'world' }const { hello } = a;hello = 'change';console.log(a.hello); // world
해도 a.hello는 바뀌지 않습니다.
const { hello } = a; 와 const hello = a["hello"]; 는 같은게 아닌가요?
같은 겁니다.
넵 감사합니다!
const { hello } = a; 와 const hello = a["hello"]; 는 같은게 아닌가요?