Build a Quiz Game - Build a Quiz Game

Tell us what’s happening:

I am unable to pass tasks 11, 13 and 14 despite multiple efforts at refactoring

Your code so far

let questions = [
{
  category: "Geography",
  question: "What is the capital city of Australia?",
  choices: ["Canberra", "Sydney", "Melbourne"],
  answer: "Canberra"
},
{
  category: "History",
  question: "What was the birth name of the British Monarch George VI?",
  choices: ["George", "Albert", "Charles"],
  answer: "Albert"
},
{
  category: "English Literature",
  question: "What was the first name of the author of the book 'Wuthering Heights'?",
  choices: ["Charlotte", "Anne", "Emily"],
  answer: "Emily"
},
{
  category: "Chemistry",
  question: "What is the chemical symbol for the element 'gold'?",
  choices: ["Ag", "Gd", "Au"],
  answer: "Au"
},
{
  category: "Biology",
  question: "What does the letter 'A' in 'DNA'refer to?",
  choices: ["Adipose", "Acid", "Alkali"],
  answer: "Acid"
}
];

function getRandomQuestion(questions) {
  let index = Math.floor(5 * Math.random());
  let randomQuestion = questions[index];
  return randomQuestion;
}

function getRandomComputerChoice(choices) {
  let index = Math.floor(3 * Math.random());
  let randomComputerChoice = choices[index];
  return randomComputerChoice;
}


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 (X11; Ubuntu; Linux x86_64; rv:155.0) Gecko/20100101 Firefox/155.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 @adam_codes

13. If the computer choice doesn’t match the answer, getResults should return The computer's choice is wrong. The correct answer is: <correct-answer>, where <correct-answer> is the value of the correct answer to the chosen question.

Check for a typo.

Happy coding