JSFiddle - React, Tailwind, and code Playground
JavaScript
var questions = [
{
id : 'citizenship-1',
category : 'citizenship',
label : 'Are you an American Citizen?',
options : ['Yes','No'],
forceAnswer : false
},
{
id : 'citizenship-2',
category : 'citizenship',
label : 'Do you live in the United States?',
options : ['Yes','No'],
forceAnswer : false
}
];
var id = 'citizenship-1';
var res = questions.filter(function(e) {
return e.id == id && e;
}, []);
console.log(res);