Tell us what’s happening:
Hello guys,
You check out this. It functions properly
Your code so far
const questions = [];
const question1 = {
category: "MCQ",
question: "What is your name?",
choices:["Ajak", "Garang", "Mathiang"],
answer: "Ajak"
}
const question2 = {
category: "MCQ",
question: "Which school do you go to?",
choices:["JKUAT", "USIU", "KU"],
answer: "USIU"
}
const question3 = {
category: "MCQ",
question: "Which sport do you play?",
choices:["Basketball", "Football", "Netball"],
answer: "Basketball"
}
const question4 = {
category: "MCQ",
question: "Who is your role model?",
choices:["Jordan", "Lebron", "Giannis"],
answer: "Giannis"
}
const question5 = {
category: "MCQ",
question: "Where do you live?",
choices:["School", "Qwetu", "Queens"],
answer: "Qwetu"
}
questions.push(question1, question2, question3, question4, question5);
//console.log(questions)
function getRandomQuestion (quesArray){
const randomNo = Math.floor(Math.random() * quesArray.length);
return quesArray[randomNo];
}
function getRandomComputerChoice(choices){
const randomNo = Math.floor(Math.random() * choices.length);
return choices[randomNo];
}
//console.log(getRandomComputerChoice(question5.choices))
function getResults(questObject, compChoice){
if(compChoice === questObject.answer){
return "The computer's choice is correct!";
}else{
return `The computer's choice is wrong. The correct answer is: ${questObject.answer}`;
}
}
const result = getResults(question1, getRandomComputerChoice(question1.choices));
console.log(result)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.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
dhess
May 5, 2026, 12:12pm
2
Hi @ajakmathiang19 ,
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.
Happy coding!
ajakmathiang19:
Tell us what’s happening:
Hello guys,
You check out this. It functions properly
Your code so far
const questions = [];
const question1 = {
category: "MCQ",
question: "What is your name?",
choices:["Ajak", "Garang", "Mathiang"],
answer: "Ajak"
}
const question2 = {
category: "MCQ",
question: "Which school do you go to?",
choices:["JKUAT", "USIU", "KU"],
answer: "USIU"
}
const question3 = {
category: "MCQ",
question: "Which sport do you play?",
choices:["Basketball", "Football", "Netball"],
answer: "Basketball"
}
const question4 = {
category: "MCQ",
question: "Who is your role model?",
choices:["Jordan", "Lebron", "Giannis"],
answer: "Giannis"
}
const question5 = {
category: "MCQ",
question: "Where do you live?",
choices:["School", "Qwetu", "Queens"],
answer: "Qwetu"
}
questions.push(question1, question2, question3, question4, question5);
//console.log(questions)
function getRandomQuestion (quesArray){
const randomNo = Math.floor(Math.random() * quesArray.length);
return quesArray[randomNo];
}
function getRandomComputerChoice(choices){
const randomNo = Math.floor(Math.random() * choices.length);
return choices[randomNo];
}
//console.log(getRandomComputerChoice(question5.choices))
function getResults(questObject, compChoice){
if(compChoice === questObject.answer){
return "The computer's choice is correct!";
}else{
return `The computer's choice is wrong. The correct answer is: ${questObject.answer}`;
}
}
const result = getResults(question1, getRandomComputerChoice(question1.choices));
console.log(result)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36
Challenge Information:
Build a Quiz Game - Build a Quiz Game
https://www.freecodecamp.org/learn/javascript-v9/lab-quiz-game/lab-[quiz-game](https://nulsbrawl.fr/)
Github Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-quiz-game/66f17db06803d11a1bd19a20.md at main · freeCodeCamp/freeCodeCamp · GitHub
Why code is blur and not showing.
ILM
May 13, 2026, 10:36am
4
we blur spoiler code
if you have questions and need help please open your own topic