Build a Quiz Game - Build a Quiz Game

Tell us what’s happening:

My code does not pass the following tests, but i think my functions take as parameters and return what they are supposed to: 8. You should have a function named getRandomQuestion that takes an array of questions as a parameter and returns a random question object from the array.
9. You should have a function named getRandomComputerChoice that takes the array of the available choices as a parameter, and returns a random answer to the selected question.

Your code so far

const questions = [
  {
    category: "Science",
    question: "What planet is known as the Red Planet?",
    choices: ["Mars", "Venus", "Jupiter"],
    answer: "Mars"
  },
  {
    category: "History",
    question: "Who was the first president of the United States?",
    choices: ["George Washington", "Abraham Lincoln", "Thomas Jefferson"],
    answer: "George Washington"
  },
  {
    category: "Geography",
    question: "What is the capital of France?",
    choices: ["Paris", "Madrid", "Rome"],
    answer: "Paris"
  },
  {
    category: "Math",
    question: "What is 5 + 5?",
    choices: ["10", "15", "20"],
    answer: "10"
  },
  {
    category: "Animals",
    question: "What is the largest land animal?",
    choices: ["Elephant", "Giraffe", "Rhinoceros"],
    answer: "Elephant"
  }
];

function getRandomQuestion(questions) {
  return questions[Math.floor(Math.random() * questions.length)];
}

function getRandomComputerChoice(choices) {
  return choices[Math.floor(Math.random() * choices.length)];
}

function getResults(question,choice){
  if(question.answer === choice){
    return "The computer's choice is correct!"
  } else {
    return "The computer's choice is wrong. The correct answer is: "+question.answer
  }
}

Your browser information:

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

Challenge Information:

Build a Quiz Game - Build a Quiz Game

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-quiz-game/66f17db06803d11a1bd19a20.md at main · freeCodeCamp/freeCodeCamp · GitHub

Welcome to the forum @hugo25gl,

Your solution works from my end. Please try one of the following steps to move forward.

Click on the “Restart Step” button and force a refresh of your page with CTRL + F5 then try to paste the code in again.

or - Try the step in incognito or private mode.

or - Disable any/all extensions that interface with the freeCodeCamp website (such as Dark Mode, Ad Blockers, or Spellcheckers), and set your browser zoom level to 100%. Both of these factors can cause tests to fail erroneously.

or - Ensure your browser is up-to-date or try a different browser.

I hope one of these will work for you.

We have blurred this solution (with [spoiler][/spoiler] tags) so that users who have not completed this challenge can read the discussion in this thread without giving away the solution.

I tried in another computer and it worked, thanks for the help!