Build a Fortune Teller - Build a Fortune Teller

Tell us what’s happening:

randomNumber is not corresponding with the selectedFortune why ?

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 neighbours.";
let fortune4 = "You will find a new hobby soon.";
let fortune5 = "It would be wise to avoid the color red today.";

let randomNumber = Math.floor(Math.random() * 6) + 1;

let selectedFortune = randomNumber

if (selectedFortune = 1) {
  selectedFortune = fortune1;
} else if (selectedFortune = 2) {
  selectedFortune = fortune2;
} else if (selectedFortune = 3) {
  selectedFortune = fortune3;
} else if (selectedFortune = 4) {
  selectedFortune = fortune4;
} else {
  selectedFortune = 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

Challenge Information:

Build a Fortune Teller - Build a Fortune Teller

Welcome to the forum @yohannes12 !

Where is randomNumber being used in your logic?

This is not the correct syntax for an equality test.

Happy coding!

1 Like