How to make a coin game


#1

I don't know how to fix it and what to do because it's not working..pls help










#2










#3

var user = prompt(Do you want to flip a coin?);
switch (yes) {
case 'yes':
console.log("Good choice");
break;

case 'no':
console.log("Bye");
break;
);
break;
default:
console.log("Sorry");
);
}
var coinChoice = true
var youHit= Math.floor(Math.random()*2)+1;
console.log(coinFlip);


#4

@julia_166

You have some syntax issues. Here is the correct way of using switch.

var user = prompt("Do you want to flip a coin?");
switch (user) {
    case 'yes':
        console.log("Good choice");
        break;

    case 'no':
        console.log("Bye");
        break;
    default:
        console.log("Sorry");
        break;
}

Also, I am not sure why you need these lines,

but you haven't defined coinFlip, so that will lead to an error.

Hope this helped.))