Tell us what’s happening:
It keeps saying I have to have the Math.random() method when I have? I’ve also tried deleting that line of code entirely and inserting “Math.random(5*1)+1;” by itself and rounding the values in a separate line of code. Anything I could be missing?
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.round(Math.random(5*1)+1);
let selectedFortune = randomNumber;
if (randomNumber == 1 ){ selectedFortune = fortune1
console.log(fortune1);
} else if (randomNumber == 2){ selectedFortune = fortune2
console.log(fortune2);
} else if (randomNumber == 3){ selectedFortune = fortune3
console.log(fortune3);
} else if (randomNumber == 4){ selectedFortune = fortune4
console.log(fortune4);
} else if (randomNumber == 5){ selectedFortune = fortune5
console.log(fortune5);
}
console.log(selectedFortune);
Your browser information:
User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Challenge Information:
Build a Fortune Teller - Build a Fortune Teller