Hello there, I am in need of some assistance as I am unsure where to begin. Any help would be greatly appreciated. Here are the two objects I have:
const Questions = {
five: "c"
four: "c"
one: "a"
three: "a"
two: "a"
};
And I also have this object:
const Answers = {
five: "a"
four: "a"
one: "a"
three: "a"
two: "a"
};
My objective is to compare these two objects and determine if there are 3 or more correct matches. Based on the comparison result, I need to display a different message. I have attempted comparing the two objects like this:
JSON.stringify(Questions) === JSON.stringify(Answers);
However, this only returns true or false. I also tried to return only the corrected answers with the following code snippet:
checkCorrectAnswers(obj1: any, obj2: any): any {
const keys1 = [];
const values1 = [];
Object.keys(obj1).forEach((element) => {
keys1.push(element);
});
Object.values(obj1).forEach((element) => {
values1.push(element);
});
// More code goes here...
}
I appreciate any further guidance or solutions provided. Thank you.