Mid-lesson breather



This is my code, but its giving me a syntax error expected ':' what did I do wrong help please!!!!

Replace this line with your code.


the url is the same for everyone, it checks for the user to load the users code in the exercise, if you need help, please copy paste your code to the forum


var answer = prompt("My bucketlist")
switch("Bucket list") {
case 'Travel to maldives'
console.log("It's a beautiful place, clear water!");
case 'Jump on a cupcake'
console.log("unleash your wild!");
case 'Have a family'
console.log("Who I can spend my time with and travel to disneyland");
console.log("Should I jump on a cupcake or a cheezy pizza!")

this is my code its says syntaxerror expected ":"


you execute the switch statement over a string:

switch("Bucket list") {

are you sure of this? the prompt stores the result in the variable answer, so that is what i would execute the switch statement on

this line:

case 'Travel to maldives'

missing : after the case:

case 'Travel to maldives':

same for all other cases.

default is missing a break. and the } is missing to close the switch statement


you were absolutely right! thank you :slight_smile: