Neeed help getting unstuck from magic 8 ball assignment

hi i need hlep wt this magic 8 ball tired of being stuck :(var userName = ‘Millie’;
userName ? console.log(Hello, ${userName}!) : console.log(‘Hello!’);
let userQuestion = ‘Will I pass?’;
console.log($"{userName} has asked - ${userQuestion});

let randomNumber = Math.floor(Math.random() * 8);
let eightBall = ‘’;

switch(randomNumber);
case:0;
eightBall = ‘It is certain’;
break;
case1:
eightBall = ‘It is decidedly so’;
break;
case2:
eightBall = ‘Reply hazy try again’;
break;
case3:
eightBall = ‘Cannot predict now’;
break;
case4:
eightBall = ‘Do not count on it’;
break;
case5:
eightBall = ‘My sources say no’;
break;
case6:
eightBall = ‘Outlook not so good’;
break;
case7:
eightBall = ‘Signs point to yes’;

console.log(The Magic 8 Ball says, ${eightball}.)/home/ccuser/workspace/learn-javascript-U2P1/main.js:9
switch(randomNumber);
^

SyntaxError: Unexpected token ‘;’
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
at internal/main/run_main_module.js:17:47

your switch is missing the { and }
it should start
switch(randomNumber) {
instead of
switch(randomNumber);

and there should be a } after the last case ends.

case:0;
should be
case 0:

case1:
should be
case 1:

example
let randomNumber = Math.floor(Math.random() * 3);
let word = "unknown";

switch(randomNumber) {
  case 0:
    word = "zero";
    break;
  case 1:
    word = "one";
    break;
  case 2:
    word = "two";
    break;
  default:
    word = "other";
}

console.log(word);
2 Likes

Hey, i would like to work on the challenge.

Here’s a link to the Magic 8 Ball practice project and instructions (JavaScipt)
https://www.codecademy.com/projects/practice/magic-eight-ball-1

1 Like

thanks so much :smiley: thanks for the example to, I can understand it the more I reread it.