Magic 8 ball switch/case

PHOTO EMBED

Mon Jul 11 2022 18:18:58 GMT+0000 (Coordinated Universal Time)

Saved by @cruz #javascript

userName='Greg';
userName ? console.log(`Hello, ${userName}`) : console.log('Hello');

let userQuestion = "Will the Giants win 14 games?";

console.log(`${userName} has asked - ${userQuestion}`);

let randomNumber = Math.floor(Math.random()*8);

console.log(randomNumber);

let eightball = '';

switch(randomNumber){
  case 0:
  eightball = 'It is certain';
  break;
  case 1:
  eightball = 'It is decidely 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 = 'you can bet on it';
  break;
  case 7:
  eightball = 'there is no doubt';
  break;
}

console.log(`The Magic 8 ball says ${eightball}.`);
content_copyCOPY