Tell us what’s happening:
I’ve been struggling for a while with user histories above 8.
Your code so far
const questions = [
{
category: 'action',
question: 'Who was creep opponenet?',
choices: ['Vicktor', 'Michael Jordan', 'FloydMaythear'],
answer: 'Vicktor'
},
{
category: 'music',
question: 'Who created the 5th symphony?',
choices: ['Mozart', 'Beethoven', 'Basch'],
answer: 'Mozart'
},
{
category: 'movie',
question: "What brand's car was Sally (car's girlfriend)? ",
choices: ['Mercedes Benz', 'Porsche', 'Bentley'],
answer: 'Porsche'
},
{
category: 'music',
question: "Who's been the most famous artist from USA?",
choices: ['Drake', 'Michael Jackson', 'John Lennon'],
answer: 'Michael Jackson'
},
{
category: 'tech',
question: "What's the device used to protect a local network?",
choices: ['router', 'wifi', 'firewall'],
answer: 'firewall'
}
]
const getRandomQuestion = (obj) => {
const randomNum = Math.floor(Math.random(1) * obj.length)
console.log(obj[randomNum].question)
}
getRandomQuestion(questions)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:153.0) Gecko/20100101 Firefox/153.0
Challenge Information:
Build a Quiz Game - Build a Quiz Game