Build a Fortune Teller - Build a Fortune Teller

Tell us what’s happening:

I can’t figure out what is wrong. My code looks right to me

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

let randomNum = Math.floor(Math.random() * 5) + 1;

let selectedFortune = "";

if(randomNum === 1){
  selectedFortune = fortune1
}else if(randomNum == 2){
  selectedFortune = fortune2
}else if(randomNum == 3){
  selectedFortune = fortune3
}else if(randomNum == 4){
  selectedFortune = fortune4
}else if(randomNum == 5){
  selectedFortune = fortune5
}
console.log(selectedFortune);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Safari/605.1.15

Challenge Information:

Build a Fortune Teller - Build a Fortune Teller

You should generate a random number between 1 and 5, inclusive, and assign it to the variable randomNumber .

You don’t have a variable in your code called randomNumber.

Thanks it works now.

1 Like