Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created February 18, 2021 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/b234660348b0087ce655aae12f30fcc4 to your computer and use it in GitHub Desktop.
Save codecademydev/b234660348b0087ce655aae12f30fcc4 to your computer and use it in GitHub Desktop.
Codecademy export
let userName = 'Elon';
userName = userName || 'Stranger';
userName ? console.log(`Time Traveler: Hello, ${userName}!`) : console.log('Hello!');
const userQuestion = 'Will we make it to Mars?';
console.log(`${userName}: ${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(`Time Traveler: ${eightBall}.`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment