What's wrong with my code?


#1

I don't know what's th problem. It says "SyntaxError: missing ) after argument list". Can someone help please?

My code:

var user = prompt("You're on a Rubik's Cube contest. Which type of cube you want to compete with? 2x2, 3x3 or pyraminx?").toLowerCase();

switch(user) {
case '2x2':
var moyu = prompt("Do you have a MoYu LingPo?".toUpperCase();
var lubrication = prompt("Have you lubricated your cube in the last 3 months?").toUpperCase();
if(moyu === "YES" && lubrication === "YES") {
var place = Math.floor(Math.random() * 5 + 1);
console.log("You've got the " + place + ". place out of 20. Congrats!");
} else if(moyu === "YES" || lubrication === "YES") {
var place = Math.floor(Math.random() * 8 + 6);
console.log("You've got the " + place + ". place out of 20. Congrats!");
} else {
var place = Math.floor(Math.random() * 7 + 14);
console.log("You've got the " + place + ". place out of 20. Congrats!");
}
case '3x3':
var practice = prompt("Have you practiced at least 1 hour in the last 2 weeks?").toUpperCase();
var lubrication = prompt("Do you have a lubricated speedcube?").toUpperCase();
if(practice === "YES" && lubrication === "YES") {
var place = Math.floor(Math.random() * 15 + 1);
console.log("You've got the " + place + ". place out of 50. Congrats!");
} else if(practice === "YES" || lubrication === "YES") {
var place = Math.floor(Math.random() * 20 + 16);
console.log("You've got the " + place + ". place out of 50. Congrats!");
} else {
var place = Math.floor(Math.random() * 15 + 36);
console.log("You've got the " + place + ". place out of 50. Congrats!");
}
case 'pyraminx':
var practice = prompt("Have you practiced at least half an hour in the last month?").toUpperCase();
if(practice === "YES") {
var place = Math.floor(Math.random() * 5 + 1);
console.log("You've got the " + place + ". place out of 10. Congrats!");
} else {
var place = Math.floor(Math.random() * 5 + 6);
console.log("You've got the " + place + ". place out of 10. Congrats!");
}
default:
console.log("Sorry, but this was not an option.")
}


#2

You are missing ) on prompt

//so:
var moyu = prompt("Do you have a MoYu LingPo?") .toUpperCase();

#3

Hi and its missing all the break to all yourcase

case "Hello"
    #do something : 
break;
case "Yeah"
    #do someting
break;
......

#4

Now it works! Thanks for your help!