Tell us what’s happening:
I passed all the text except for 9, please check my code and tell me why it’s not able to pass the text
Your code so far
const questions = [
{category: 'mathematic',
question: 'what is BODMAS?',
choices: ['Branch Of Division Multiplication Addition Subtraction.',
'Bracket Of Division Multiplication Addition Subtraction.',
'Both.'],
answer: 'Bracket Of Division Multiplication Addition Subtraction.'
},
{category: 'Biology',
question: 'what is the study of plant?',
choices: ['Botany.','Virulogy.','Plantology.'],
answer: 'Botany.'
},
{category: 'Crs',
question: 'who betrayed Jesus?',
choices: ['Peter.','James.','Judas.'],
answer: 'Judas.'
},
{category: 'Agricultural Science',
question: 'what is the process in which plant recieve nutrient through sunlight?',
choices: ['Fusioning.','lightrays.','Photosynthesis.'],
answer: 'Photosynthesis.'
},
{
category: 'History',
question: 'when did the first world war start?',
choices: ['1914.', '1912.', '1916.'],
answer: "1914."
}
]
let random = Math.floor(Math.random() * questions.length)
function getRandomQuestion(array){
return array[random]
}
function getRandomComputerChoice(choice){
const choices = choice[random].choices
let randomChoice = Math.floor(Math.random() * choices.length)
return choices[randomChoice]
}
function getResults(questArr, computerArr){
let arr = questArr.answer
if(computerArr === arr){
return "The computer's choice is correct!"
}else{
return `The computer's choice is wrong. The correct answer is: ${arr}`
}
}
Your browser information:
User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Mobile Safari/537.36
Challenge Information:
Build a Quiz Game - Build a Quiz Game