Build a Fortune Teller - Build a Fortune Teller

Tell us what’s happening:

I am not sure what is wrong here, I put the if then statement and it then tells me that everything I am missing everything needed to pass the lab.

Your code so far

const fortune1 = "You will be happy";
const fortune2 = "You will be sad";
const fortune3 = "You will be hangry";
const fortune4 = "You will be mad";
const fortune5 = "You should stay in tomorrow";

const min = 1;
const max = 5;
const randomNumber = Math.floor(Math.random() * (max - min) + min);

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

Challenge Information:

Build a Fortune Teller - Build a Fortune Teller

I suggest you brush up on global scope, local scope and block scope.

The let keyword is more appropriate here if your variable name is the same. I suggest you also check the let keyword again.

This needs some tweaks to pass

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.