Magic Eight ball Help

Hi Guys,

This is my code that works very well.

[codebyte]
var userName = ‘’;

userName === ‘Janae’? console.log(“Hello, Jane!”): console.log(‘Hello’);

const userQuestion = ‘Do you want to play the Magic eight Ball?’

console.log(userQuestion);

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

console.log(randomNumber);

const eightBall= randomNumber;

switch(eightBall){

case 1:

console.log(‘It is certain’);

break;

case 2:

console.log(‘It is decidedly so’);

break;

case 3:

console.log(‘Reply hazy try again’);

break;

case 4:

console.log(‘Cannot predict now’);

break;

case 5:

console.log(‘Do not count on it’);

break;

case 6:

console.log(‘My sources say no’);

break;

case 7:

console.log(‘Outlook not so good’);

break;

default:

console.log(‘Signs point to yes’);

}

Took the scenic route but got this working well. I had already done this on Python; was cool to see in .js too.

**

let userName = “Name”

console.log(Hello ${userName});

//

const userQuestion = ‘Will I win the powerball??’

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

//

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

//

let eightBall = ‘’

//

if (randomNumber === 1) {

eightBall =‘It is certain’;

} else if (randomNumber === 2) {

eightBall =‘It is decidedly so’;

} else if (randomNumber === 3) {

eightBall =‘Reply hazy try again’;

} else if (randomNumber === 4 ){

eightBall =‘Cannot predict now’;

} else if (randomNumber === 5) {

console.log(‘Do not count on it’);

} else if (randomNumber === 6) {

eightBall = ‘My sources say no’;

} else if (randomNumber === 7 ){

eightBall =‘Outlook not so good’;

} else if (randomNumber === 0 ){

eightBall =‘Signs point to yes’;

} else {

eightBall =‘try again pal’;

}

//

console.log(Magic Eight Ball says ${eightBall});

// End of Program