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 filtered = $(questions).filter(function (i, n) {
return n.id === 'citizenship-2';
});
console.log(filtered[0].category);