Build a Fortune Teller - Build a Fortune Teller

Tell us what’s happening:

Please, I need help:

I don’t understand what i am doing wrong. I keep getting the message:

“The randomNumber should correspond to its fortune. For example, if randomNumber is 1, the selectedFortune should be equal to fortune1 and so on.”

I think I followed the instructions well. I would appreciate it if anyone could point out my error.

Your code so far

const fortune1 = "Your cat will look very cuddly today.";
const fortune2 = "The weather will be nice tomorrow.";
const fortune3 = "Be cautions 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;
let selectedFortune = randomNumber;

if (randomNumber === 1) {
      selectedNumber = fortune1;
} else if (randomNumber === 2) {
      selectedNumber = fortune2;
} else if (randomNumber === 3) {
      selectedNumber = fortune3;
} else if (randomNumber === 4) {
      selectedNumber = fortune4;
} else if (randomNumber === 5) {
      selectedNumber = 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/146.0.0.0 Safari/537.36 Edg/146.0.0.0

Challenge Information:

Build a Fortune Teller - Build a Fortune Teller

hello @Only1AGU welcome to the forum!

Is the variable that you want to change named selectedNumber?

Thanks for your reply.
selectedNumber should have been selectedFortune.
I have fixed it.

1 Like