2. old enough to play


#1

(if age=prompt "you are older than 18 you can play"
console.log "its ok you can play next year"

var age = prompt("What's your age");
if age < 13
{
console.log("You are allowed to play but we have no reponsibilty ")

}
else
{
console.log("Have fun playing")

}


#2

Woww..... @mahir30 what in the top line of the code?


#3

i got it thanks i correct my mistake


#4

whats wrong here??

var age = prompt("What's your age");
if (age < 13)
{
console.log("You are allowed to play but we have no reponsibilty ")

}
else
{
console.log("Have fun playing")

}
console.log("You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.")
var userAnswer = prompt("Do you wanna race JB")
if (userAnswer =yes)
{
console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!");
}

else
{
console.log("Sudenly, Bieber stops ");
}


#5

Right there... im sure you can figure out your problem then..


#6

even after i put the yes in "" is doesnt work??


#7

nvm i got it i didnt copy the message right


#8

Make sure your doing exactly what the instructions say.... This is how it goes

console.log("You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'");

console.log("Suddenly, Bieber stops and says, 'Who wants to race me?'");

var userAnswer = prompt("Do you want to race Bieber on stage?");

#9

thank you i really appreciate it


#10

So maybe you guys can help me. Here's my code.

// Check if the user is ready to play!
confirm("I am ready to play!");
var age = prompt("What's you age");
if(age < 13){
console.log("You're allowed to play, but we are not responsible.");
}else{
console.log("play on!");

After I run it, I get 'Error: Unspecified error.' And I just can't seem to find my error. Anybody want to take a crack at it?


#11

Hmm @rubyrunner18857 missing the curly braces? :wink:


#12

I don't how I missed that. Thank you!


#13

confirm("Are you ready to play?");
var age = prompt("What is your age?");
if (age < 13) {
console.log("You are allowed to play, but I take no responsibility.");
} else {
console.log("Play on!");
}


#14

That is the answer I hope you get it right.