Trouble with the eight ball project

Hey guys!

I reached the eight ball project in the Javascript exercise. I think I kept up alright up until here, but I certainly started to have some difficulties lately. I got to the end of the exercise and I am getting errors the whole time and I can’t figure out what I did wrong for an hour now. Here is what I came up with:

let userName = 'Jane'; userName === 'Jane' ? console.log(`Hello ${userName}`) : console.log('Hello!'); let userQuestion = 'A'; console.log(`The user asked: ${userQUestion}`); let randomNumber = Math.floor(Math.random() * 8); let eightBall = 'A'; if 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 = 'Do not count on it'; break; case 5: eightBall = 'My sources say no'; break; case 6: eightBall = 'Outlook not so good'; break; case 7: eightBall = 'Signs point to yes'; break; } console.log(`The eight ball answered: ${eightBall}`);

At first, I had the final console.log after every option. I also had case 0; instead of case 0: before for all of them. I watched the video to figure that out. Since it is either watching the video or looking at the code, it is hard to figure out the issues. Also, the error box is not helpful at all. What is written in there doesn’t seem to be related to the code at all and doesn’t give any hint on what is wrong at all to me. This course is my starting point in coding, so please explain it in the most basic way as possible. Thanks!


WOW. The hint for 8 stated:

console.log(The eight ball answered: ${eightBall}); for some reason, it doesn’t display the ` in the post.

while the solution in the video is just


and with the solution from the video, it worked straight away. I am actually mad now.

Hi, you have a typo in your console.log for the userQuuestion. You put a capital u in userQuestion. You also started your switch statement with an if. Remove the if and all will be good. Have a great day!

Thank you! I watched the video again and I figured that out in the meanwhile. But now I am in trouble with the Bob money game. I posted about it here: Trouble with the bob game in Javascript

Since there is no error console at all and the game stays blank I am in real trouble there.