我正在學習編寫JavaScript代碼,並寫了這個代碼的ReferenceError:是沒有定義
var userAnswer = prompt("are you feeling lucky, punk?");
if (userAnswer === yes)
{
console.log("Batman hits you very hard. It's Batman and you're you! Of course Batman wins!");
}
else
{
console.log("You did not say yes to feeling lucky. Good choice! You are a winner in the game of not getting beaten up by Batman.");
}
但是當我運行它,我得到 的ReferenceError:未定義肯定。
'if(userAnswer ==='yes')'...... – Reimeus
這不是java。 – Blub