我修改了之前遇到问题的代码,修复了所有错误并在不同的“lint”站点上多次检查。只是为了确保代码在 Jsfiddle 中有效,我单击了 JShint 并被告知一切都有效,但是当我单击按钮时不会运行。创建链接的示例代码:
(function (g) { "use strict"; //g = game
g = this[g] = function () {
var answer;
//pre game
answer = prompt(g.msg[0]); //instruction prompt asks if youve played game
if (answer === 'no') {