I’m in the process of wrapping up this project and when I print out the console.log statement at the end occassionally (randomly), it won’t print out an answer from the switch statement and it’ll be blank. I triple checked the switch statement and can’t find any syntax errors. Could someone perhaps help spot why it’s throwing out a blank answer?
const userName = '' || 'Stranger';
console.log(`Hello ${userName}!`)
const userQuestion = 'What is the answer to life?';
console.log(`Great question ${userName}! You 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 = '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(eightBall);