Tell us what’s happening:
the output im getting, “7. You should generate a random number between 1 and 5, inclusive, and assign it to the variable randomNumber.
9. The randomNumber should correspond to its fortune. For example, if randomNumber is 1, the selectedFortune should be equal to fortune1 and so on.”
ive assigned the variable and called it so im confused on what i still must do. any tips before giving the solution?
Your code so far
const fortune1 = 'Your cat will look very cuddly today.';
const fortune2 = 'The weather will be nice tomorrow.';
const fortune3 = 'You will find $50 on the gound on your way to work this week.'
const fortune4 = 'Your partner will get you a gift tonight.';
const fortune5 = 'You will recieve a new job offer on friday from the career of your dreams.';
let randomNumber = Math.random() * (5 - 1) + 1;
let selectedFortune = Math.floor(randomNumber);
console.log(selectedFortune);
if (selectedFortune == 1) {
console.log(fortune1);
}
else if (selectedFortune == 2) {
console.log(fortune2);
}
else if (selectedFortune == 3) {
console.log(fortune3);
}
else if (selectedFortune == 4) {
console.log(fortune4);
}
else if (selectedFortune == 5) {
console.log(fortune5);
}
console.log(selectedFortune)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Challenge Information:
Build a Fortune Teller - Build a Fortune Teller