Tell us what’s happening:
I have tried to pass number 8 but is not working and the code is working fine
Your code so far
const questions = [
{
category: "Human",
question: "Are you a man?",
choices: ["Man", "Woman", "both"],
answer: "Man"
},
{
category: "Animal",
question: "Which animal is this?",
choices: ["cat", "lion", "monkey"],
answer: "cat"
},
{
category: "bird",
question: "Which bird is this?",
choices: ["eagle", "housefly", "ant"],
answer: "eagle"
},
{
category: "Object",
question: "what is this?",
choices: ["pin", "paper", "pen"],
answer: "paper"
},
{
category: "color",
question: "Which color is this?",
choices: ["Red", "Green", "yellow"],
answer: "Green"
}
]
function getRandomQuestion(questions){
return questions[Math.floor(Math.random() * questions.length)].question
}
console.log(getRandomQuestion(questions))
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Challenge Information:
Build a Quiz Game - Build a Quiz Game