let userName = '';
userName ? console.log(`Hello, ${userName}!`) : console.log('Hello!');
let question = 'Am I going to get a good grade on this assignment';
let randomNumber = Math.floor(Math.random() * 8);
let eightBall = generateAnswer(randomNumber);
function generateAnswer(num) {
switch (num) {
case 0:
return 'It is certain';
case 1:
return 'It is decidedly so';
case 2:
return 'Reply hazy try again';
case 3:
return 'Cannot predict now';
case 4:
return 'Do not count on it';
case 5:
return 'My sources say no';
case 6:
return 'Outlook not so good';
case 7:
return 'Signs point to yes';
}
}
console.log(eightBall);