This is all my code bellow, you can see i had it working with switch() statements but now building with if / else statements its no longer random.
let userName =‘John’;
userName ? console.log(Hello, ${userName}
) : console.log(‘Hello’);
let userQuestion =‘will it snow’;
if (userName === ‘’) {
console.log(So you want to know: ${userQuestion}?
)
} else {
console.log(${userName} wants to know: ${userQuestion}?
); }
let randomNumber = Math.floor(Math.random() * 8);
let eightBall = ‘’;
if (randomNumer = 0) {
console.log(‘It is certain’)
} else if (randomNumber = 1) {
console.log(‘it is decidedly so’)
} else if (randomNumber = 2) {
console.log(‘not on my watch’)
} else if (randomNumber = 3) {
console.log(‘maybe, maybe not’)
} else if (randomNumber = 4) {
console.log(‘defo’)
} else if (randomNumber = 5) {
console.log(‘narp’)
} else if (randomNumber = 6) {
console.log(‘■■■■ no’)
} else if (randomNumber = 7) {
console.log(‘heck yeah’);
}
/*
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(eightBall);