Hi guys, this is very frustrating. I managed to do the ‘switch’ code successfully, but I’m not sure why my ‘if’ and ‘else if’ conditionals are not producing a successful result. Any advice would be appreciated, please see below for code!
let userName = 'xx';
userName ? console.log(`Hello ${userName}!`) : console.log('Hello!');
const userQuestion = 'Will the dogs bark?';
console.log((`${userQuestion}`), (`${userName}`));
let randomNumber = Math.floor(Math.random() * 8);
let eightBall = '';
if (randomNumber === 0) {
console.log(eightBall = 'Certain')
};
else if (randomNumber === 1) {
console.log(eightBall = 'Decidedly so')
}
else if (randomNumber === 2) {
console.log(eightBall = 'Hazy, try again')
}
else if (randomNumber === 3) {
console.log(eightBall = 'Cannot predict now')
}
else if (randomNumber === 4) {
console.log(eightBall = 'Do not count on it')
}
else if (randomNumber === 5) {
console.log(eightBall = 'Sources say no')
}
else if (randomNumber === 6) {
console.log(eightBall = 'Not good outlook')
}
else (randomNumber === 7) {
console.log(eightBall ='Signs point to yes')
}
console.log(eightBall)