Build a Quiz Game - Build a Quiz Game

Tell us what’s happening:

only issue is the getResults function all steps are ticked except last 11 to 14 which all belong to that one last function surely there’s one or two changes that will fix it.
can you help me with it?

Your code so far

const questions = [{
category: "color?",
question: "what is your favorite color?",
choices: ["blue","pink","green"],
answer: "green"
},
 {
  category: "living place?",
question: "do you like living there ?",
choices: ["Bursa","Ankara","Istanbul"],
answer: "Istanbul"
},
 {
  category: "field of study?",
question: "do you grageuated?",
choices: ["computer","Math","teacher"],
answer: "computer"
},
 {
  category: "cooking?",
question: "What is your favorite food?",
choices: ["Pizza","Ege","Rice"],
answer: "Ege"
},
 {
  category: "sports?",
question: "What is your favorite sport?",
choices: ["football", "volleyball","swimming"],
answer: "volleyball"
}];

const getRandomQuestion = (questions) => {
const randomIndex = Math.floor(Math.random() * questions.length);
return questions[randomIndex];
};

const getRandomComputerChoice = (choices) => {
const randomIndex = Math.floor(Math.random() * choices.length);
return choices[randomIndex];
};

const getResults = (question, computerChoice) => {
  computerChoice = getRandomComputerChoice(questions.choices);
  question = getRandomQuestion(questions);
  if(computerChoice === question){
    return "The computer's choice is correct!";
  } else {
    return `The computer's choice is wrong. The correct answer is: ${computerChoice}`;
  };
};



Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36

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

please use the function parameters without overwriting them

Hi @Ruhollahbayani,

The parameter values should be passed to the function…and shouldn’t you be getting choices from the random question?

Happy coding

const getResults = (question, computerChoice) => {
  if(computerChoice === question.answer){
    return "The computer's choice is correct!";
  } else {
    return `The computer's choice is wrong. The correct answer is: ${computerChoice}`;
  };
};

step 12 has been ticked but I still miss something to get others right

got it. thank you, I found the second Issue