Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created July 26, 2017 16:32
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/841357fa92dc7169a9c8a30f22af5613 to your computer and use it in GitHub Desktop.
Save codecademydev/841357fa92dc7169a9c8a30f22af5613 to your computer and use it in GitHub Desktop.
Codecademy export
var userQuestion = 'Will I be rich?';
var randomNumber = Math.floor(Math.random() * 7);
var eightBall = '';
switch(randomNumber) {
case 0:
eightBall = 'Reply hazy try again';
break;
case 1:
eightBall = 'It is certain');
break;
case 2:
eightBall = 'It is decidedly so';
break;
case 3:
eightBall = 'Cannot predict now';
break;
case 4:
eightBall = 'Don\'t 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 eight ball ansered: ' + eightBall);
Copy link

ghost commented Jun 12, 2018

let userName = ''; userName === 'Jane!' ?console.log(hello, ${userName}) : console.log('Hello!'); const userQuestion = 'Will I become a werewolf tonight?'; console.log(userQuestion); 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 = '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; default: console.log('no eigthBall found!') } console.log(The eight ball answered: ${eightBall}) */

Copy link

ghost commented Jun 12, 2018

var randomNumber = Math.floor(Math.random() * 7); from 0 to 6 case 7:
eightBall = 'Signs point to yes'; can't be print so you should *8
let randomNumber = Math.floor(Math.random() * 8); from 0 to 7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment