Build a Fortune Teller - Build a Fortune Teller

Tell us what’s happening:

The first line of code I have is this: const fortune1 = “Your cat will look very cuddly today.”;

but I get the error message: You should initialize fortune1 with a string value.

What is happing here?

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() * 6) + 1;
let selectedFortune;

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

1 Like

you have a typo.

To find the typo, I suggest clearing the lab by pressing the Reset button and then copy the code that you have above into the editor. Do not click any buttons, just copy the code.
The console will show you the error.

:rofl: :sob: I guess I was tired. thank you I saw the error and corrected it, even the 6 I had in the code.

1 Like