Quiz

Report a typo

We created a quiz for students. We ask them the following question: Who are the three most influential people in history? They need to list them from most to less influential. The frontend sends us their answers in the URL, we need to check them against the correct answer and give our feedback based on the result.

Put these lines of code in the correct order so that it accomplishes our goal.

Put the items in the correct order
JSON.stringify(queryObj) === JSON.stringify(correctAnswer)
? (feedback = 'You nailed it!')
: (feedback = "Don't give up, try again!");
const checkAnswer = (url) => {
let feedback;
const query = url.split('?')[1];
const queryObj = parse(query);
const { parse } = require('node:querystring');
const correctAnswer = {1: "Muhammad", 2: "Isaac Newton", 3: "Jesus"};
const link = 'https://quiz/answers?1=Muhammad&2=Jesus&3=Isaac+Newton';
return feedback
};
___

Create a free account to access the full topic