【发布时间】:2020-12-21 20:14:35
【问题描述】:
class Hangman{
constructor(lives){
this.hintChoice=5;
this.lives=lives;
this.newGame();
}
newQuestion(){
this.hintChoice=10;//PROBLEM LINE
}
displayClue(){
clueDiv.innerText='Clue -'+' '+ this.hintChoice;
}
}
调用newQuestion()时,为什么this.hintChoice的值没有全局变为10?
【问题讨论】: