Help with EightBall Project

Hello!
I’m fairly new to JS and am stuck with the Project Magic Eightball. I cannot for the live of me figure out where I went wrong, it just will not log the variable eightBall??

Please help.

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

let userQuestion = 'Does he like me';
console.log(`Your question: ${userQuestion}`);

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

let eightBall = '';

switch (randomNumber) {
case 0:
eightball = 'Tru dat.';
break;
case 1:
eightball = 'Sure, why not.';
break;
case 2:
eightball = 'Oh come on';
break;
case 3:
eightball = 'As if.';
break;
case 4:
eightball = 'You wish.';
break;
case 5:
eightball = 'stop kidding yourself';
break;
case 6:
eightball = 'You are one lucky ■■■■■';
break;
case 7:
eightball = 'Maaaaaybe.';
break;
}

console.log(`The Magic Eightball says: ${eightBall}`);



Hi there, and welcome to the community!

Could it be that the variable is still empty when logged?

Notice anything?

2 Likes

:woman_facepalming: the devil is in the details, thank you so much! nearly drove me nuts :smiley:

2 Likes