Tell us what’s happening:
#9 keeps getting marks wrong. It states, “The randomNumber should correspond to its fortune. For example, if randomNumber is 1, the selectedFortune should be equal to fortune1 and so on.” The result I keep getting is a number and "undefined "under it. Not sure what I am doing wrong. Please help.
Your code so far
const fortune1 = "Your cat will look very cuddly today.";
const fortune2 = "The weather will be nice tomorrow.";
const fortune3 = "Be cautious of your new neighbors.";
const fortune4 = "You will find a new hobby soon.";
const fortune5 = "It would be wise to avoid the color red today.";
const randomNumber = Math.floor(Math.random()* 5) +1;
console.log(randomNumber);
let selectedFortune;
if (selectedFortune === 1){
selectedFortune = fortune1;
}
else if (selectedFortune === 2){
selectedFortune = fortune2;
}
else if (selectedFortune === 3){
selectedFortune = fortune3;
}
else if (selectedFortune === 4){
selectedFortune = fortune4;
}
else if (selectedFortune === 5){
selectedFortune = fortune5;
}
console.log(selectedFortune);
Your browser information:
User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36
Challenge Information:
Build a Fortune Teller - Build a Fortune Teller