Codecademy控制台坏了吗?

时间:2013-09-08 09:00:12

标签: javascript console

我正在使用Codeacademy.com。控制台不会通过它。我联系了他们,但有人看到我的代码有什么问题吗?

第4/7节,问题5.“故事升温。”

console.log("Batman glares at you.");
var userAnswer = prompt("Are you feeling lucky, punk!?", "");
if(userAnswer.toLowerCase() === "yes"){
    console.log("Batman hits you very hard");
} 
else{
    console.log("You did not say yes to feeling lucky.");
}

链接教程: http://www.codecademy.com/courses/javascript-beginner-en-x9DnD/0/5?curriculum_id=506324b3a7dffd00020bf661#

1 个答案:

答案 0 :(得分:2)

试试这个


//Check if the user is ready to play!
confirm("Are you ready?");

var age=prompt("How old are you?");

if (age>17){
console.log("play on");
}
else
{
console.log("i don't care");
}
//Story
console.log("Snow White and Batman were hanging out at the bus stop, waiting to go to the shops. There was a sale on and both needed some new threads. You've never really liked Batman. You walk up to him.");
console.log("Batman glares at you");

var userAnswer;
var userAnswer=prompt;
prompt("are you feeling lucky?");
if (prompt==="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.");