I did this for the practice, however, the output is this one:
Hello, Paulina
Paulina asked: Will I get a job?
The eight ball answered:
And then nothing happens. It’s like it’s ignoring the whole cases. What am I doing wrong?
Thank you in advance for your help.
Paulina
let userName = "Paulina";
userName ? console.log(`Hello, ${userName}`) : console.log("Hello!");
const userQuestion = "Will I get a job?";
console.log(`${userName} asked: ${userQuestion}`);
const randomNumber = Math.floor(Math.random) * 8;
let eightBall = "";
switch (randomNumber) {
case 0 :
eightBall = "It is certain";
break;
case 1 :
eightBall = "It is decidedly so";
break;
case 2 :
eightBall = "Replay hazy, tray again";
break;
case 3 :
eightBall = "Cannot predict now";
break;
case 4 :
eightBall = "Do not count on it";
break;
case 5 :
eightBall = "My sources say no";
break;
case 6 :
eightBall = "Absolutly YES!";
break;
case 7:
eightBall = "Signs point to yes";
break;
}
console.log("The eight ball answered: " +(eightBall));