Tell us what’s happening:
Can someone help to see what am I missing with my code? I really don’t know how to progress
Your code so far
const questions = [];
const question1 = {
category: "History",
question: "what's the real name of Pancho Villa?",
choices: ["David Villa", "Francisco Villa", "Doroteo Arango"],
answer: "Doroteo Arango"
};
const question2 ={
category: "Trivia",
question: "In which year was Sunbather by Deafheaven released?",
choices: ["2011", "2015", "2013"],
answer: "2013"
};
const question3 ={
category: "Science",
question: "Which is the most present element in the organical things?",
choices: ["oxygen", "carbon", "blood"],
answer: "carbon"
};
const question4 ={
category: "literature",
question: "who wrote the novel the stranger",
choices: ["Mark Twain", "Albert Camus", "Jorge Luis Borges"],
answer: "Albert Camus"
};
const question5 ={
category: "Programming",
question: "Which of the following programming languages are you learning with this excersise?",
choices: ["C++", "Python", "JavaScript"],
answer: "JavaScript"
};
function getRandomQuestion () {
let randomQuestion = Math.floor(Math.random()* questions.length)
return questions[randomQuestion];
}
function getRandomComputerChoice () {
let randomComputerChoice = Math.floor(Math.random()* choices.length)
return choices[randomComputerChoice];
}
function getResults (question, randomComputerChoice) {
if (randomComputerChoice === answer){
return "The computer's choice is correct!"}
else if (randomComputerChoice !== answer) {
return `The computer's choice is wrong. The correct answer is:${answer}`
}
};
console.log(questions.question1)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Challenge Information:
Build a Quiz Game - Build a Quiz Game