const quizData = [{
question: "Which of the following purpose, JavaScript is designed for ?",
a: 'To Execute Query Related to DB on Server',
b: 'To Style HTML Pages',
c: ' To Perform Server Side Scripting Opertion',
d: ' To add interactivity to HTML Pages.',
correct: 'd'
},
{
question: "how old is adnan?",
a: '10',
b: '20',
c: '30',
d: '40',
correct: 'c'
}]
The above is a quiz data. I want to get only the value of key that is in key 'correct' value. Like in first question the correct answer is 'd' so I only want to get the value of key 'd'.
I tried this code but it gave undefined answer
let rs = quizData[0].correct
console.log(quizData[0].question + "\n" + quizData[0].rs)