Skip to content

Instantly share code, notes, and snippets.

@Elsrita
Created December 12, 2017 14:27
Show Gist options
  • Save Elsrita/0e95fc2ad41059d946c489122cd77d1f to your computer and use it in GitHub Desktop.
Save Elsrita/0e95fc2ad41059d946c489122cd77d1f to your computer and use it in GitHub Desktop.
let userName = '';
userName ? console.log(`Hello, ${userName}!`) : console.log('Hello!');
let userQuestion = 'Will it snow today?';
let 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 = 'Dont 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 user asked: ${userQuestion}`);
console.log(`The eightball answered: ${eightBall}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment