JSFiddle - React, Tailwind, and code Playground
JavaScript
var myObj = {
"qId": "726112",
"text": "xx",
"answers": [{
"answerId": null,
"answerUId": 1,
"text": "xx",
"correct": null,
"response": false
}, {
"answerId": null,
"answerUId": 2,
"text": "xx",
"correct": null,
"response": false
}, {
"answerId": null,
"answerUId": 4,
"text": "xx",
"correct": null,
"response": true
}]
};
if (myObj.answers.some(function (answer) {
return answer.response;
})) {
console.log("Atleast one of them was true");
} else {
console.log("None of them was true");
}