Tell us what’s happening:
It said that I should initialize the variable fortune3 with a string. I’ve done it, but that doesn’t work.
Your code so far
let fortune1 = "Your cat will look very cuddly today.";
let fortune2 = "The weather will be nice tomorrow.";
let fortune3 = "Be cautious of your new neighbors.";
let fortune4 = "You will find a new hobby soon.";
let fortune5 = "It would be wise to avoid the color red today.";
let randomNumber = Math.random();
let selectedFortune;
if (randomNumber == 1) {
fortune1 = selectedFortune;
}
else if (randomNumber == 2) {
fortune2 = selectedFortune;
}
else if (randomNumber = 3) {
fortune3 = selectedFortune;
}
else if (randomNumber = 4) {
fortune4 = selectedFortune;
}
else if (randomNumber = 5) {
fortune5 = selectedFortune;
}
console.log(selectedFortune);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36
Challenge Information:
Build a Fortune Teller - Build a Fortune Teller