Build a Quiz Game - Build a Quiz Game

Tell us what’s happening:

Hi, so as far as can tell from console logs, this script does exactly what it’s supposed to, but it fails most of the checks. What am I missing?

Your code so far

let questions = [
    {
        category: "Browsers",
        question: "Which browser invented tabbed browsing?",
        choices: ["Firefox", "IE", "Netscape"],
        answer: "Firefox"
    },
    {
        category: "Browsers",
        question: "Which browser is MS Edge based upon?",
        choices: ["Firefox", "Chrome", "Opera"],
        answer: "Chrome"
    },
    {
        category: "OS",
        question: "Which Windows version invented tabbed file browsing?",
        choices: ["WinXP", "Win11", "Win8"],
        answer: "Win11"
    },
    {
        category: "TV",
        question: "Who is the actual owner of Marvel Studios?",
        choices: ["Disney", "WB", "Paramount"],
        answer: "Disney"
    },
    {
        category: "TV",
        question: "Which streaming service produced House of Cards?",
        choices: ["HBO Max", "Netflix", "Hulu"],
        answer: "Netflix"
    }
];

let questionNumber = Math.floor(Math.random()*questions.length);
console.log(questionNumber);
const getRandomQuestion = (arr) => {return arr[questionNumber].question};
let randomQuestion = getRandomQuestion(questions)
console.log(randomQuestion);
const getRandomComputerAnswer = (arr) => { return arr[questionNumber].choices[Math.floor(Math.random() * 3)] };
let computerAnswer = getRandomComputerAnswer(questions)
console.log(computerAnswer)

const getResults = (arr, str) => {
    if (arr[questionNumber].answer === str) { return "The computer's choice is correct!" }
    else { return `The computer's choice is wrong. The correct answer is: ${arr[questionNumber].answer}` }
};
console.log(getResults(questions, computerAnswer));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 Edg/146.0.0.0

Challenge Information:

Build a Quiz Game - Build a Quiz Game

Welcome back @mks616 ,

Is getRandomQuestion returning a question object?

Happy coding!