问题描述
我正在尝试设置一个事件监听器,一旦游戏初始化它就会“监听”。但是当我加载页面时,出现以下错误:
hangman.js:10 Uncaught TypeError: newGame is not a function
at init (hangman.js:10)
at hangman.js:191
这是相关代码:
var init = function (){
var timer;
input = prompt('Please enter a guessable word: ')
welcome.textContent = 'Player 1 has entered a word. Player two may begin guessing';
word.textContent = input;
setTimeout(invisibleOpener,13000);
newGame()
}
var newGame = function(){
startGame.addEventListener('click',function(){
console.log('test');
})
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)