Build a Quiz Game - Build a Quiz Game

Tell us what’s happening:

help me with 9 and 13, i did my best but couldn’t solve them

Your code so far

const questions = [
  {
  category: 'introduce yourself',        question: 'what you do for living?', choices: ['carpenter', 'barber', 'masson'], 
  answer: 'carpenter'
  }, 
  {
    category: 'your home', 
    question: 'what is your home address?', 
    choices: ['spana', 'kibengwe', 'kalaman'], 
    answer: 'kibengwe'
    },
    {
    category: 'your family', 
    question: 'how many brothers do you have?', 
    choices: ['two brothers', 'three brothers', 'more brothers'], 
    answer: 'two brothers'
    }, 
    {
      category: 'your ideas', 
      question: 'can you invent a more valuable software?', 
      choices: ['no', 'maybe', 'yes'], answer: 'maybe'
      }, 
      {
    category: 'hobbies', 
    question: 'what is your hobbies?',   choices: ['football', 'music', 'swimming'], 
    answer: 'music'
    }
  ];

  let random2 = Math.round(Math.random() * (questions[0].choices.length - 1));
let random = Math.round(Math.random() * (questions.length - 1));

function getRandomQuestion(questions) {
    return questions[random];
}
 console.log(getRandomQuestion(questions));
 let  firstAnswer = questions[0].choices[random2];
 console.log(firstAnswer)

 function getRandomComputerChoice(thisOne) {
   thisOne = firstAnswer;
   console.log(`hey ${thisOne}`)
   return thisOne;
   
 }
 console.log(getRandomComputerChoice());

let choices = questions[0].choices[0];
let questioning = questions[0].question;
let answer = questions[0].answer;

function getResults(question, choice) {
    question = answer;
    if(question == choice) {
      return `The computer's choice is correct!`
    } else {
      return `The computer's choice is wrong. The correct answer is: ${questions[0].choices[0]}`
    }
}
console.log(getResults(questioning, 'carpenter'))

Your browser information:

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

Challenge Information:

Build a Quiz Game - Build a Quiz Game

i solved no.9, still struggle with no.13

why are you replacing the function argument?, do not change the value

do not use global varianles, not here, not in the output strings

i replaced with this but still fail.

function getResults(question, choice) {

question = questions[0].answer;

if(choice === question) {

  return \`The computer's choice is correct!\`

}  else {

  return \`The computer's choice is wrong. The correct answer is: ${question}\`

}

}

console.log(getResults(questions[0].answer, ‘carpenter’));

console.log(getResults(questions[0].question, ‘barber’));

you are still replacing the function parameter, do not do that, you must use the value passed in to the function

you also need to read again what the function is going to receive as argument