Why it does not run?


#1

https://www.codecademy.com/courses/learn-javascript-control-flow/projects/magic-eight-ball?r=master

I do not understand why my code does not run on the console. Please help :slight_smile:

Here is the code:

//1
let userName = '';

userName === '' ?  console.log('Hello!'):
console.log(`Hello, ${userName}!`);

//2
let userQuestion = 'Can I marry with you?';

//3
let randomNumber = Math.floor(Math.random()*8);

//4
let eightBall = '';
switch (randomNumber) {
  case  0 :
    	 eightBall = 'It is certain';
    break;
  case  1 :
    	 eightBall = 'It is decidedly so';
    break;
  case  2 :
    	 eightBall = 'Reply hazy try again';
    break;
  case  3 :
    	 eightBall = 'Cannot predict now';
    break;
  case  4 :
    	 eightBall = "Don't count on it";
    break;
  case  5 :
    	 eightBall = 'My sources say no;
    break;
  case  6 :
    	 eightBall = 'Outlook not so good';
    break;
  case  7 :
    	 eightBall = 'You are in grave danger';
    break;
                    }


console.log( userName + "asked " + userQuestion);
console.log('The eight ball answered: ' + eightBall);

#2

look at this:

  case  4 :
    	 eightBall = "Don't count on it";
    break;
  case  5 :
    	 eightBall = 'My sources say no;
    break;
  case  6 :
    	 eightBall = 'Outlook not so good';

the color tells you forgot to close a string somewhere


#3

You are missing the ’ after no