Mid-lesson breather


#1


https://www.codecademy.com/en/courses/javascript-beginner-en-qDwp0/1/5?curriculum_id=506324b3a7dffd00020bf661

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.


#2

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


#3

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

this is my code its says syntaxerror expected ":"


#4

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


#5

you were absolutely right! thank you :slight_smile:


#6