JSFiddle - React, Tailwind, and code Playground
JavaScript
var purposeObjects = [
{purpose: "daily"},
{purpose: "weekly"},
{purpose: "monthly"}
];
function findPurpose(purposeName){
return $.grep(purposeObjects, function(item){
return item.purpose == purposeName;
});
};
alert(findPurpose('daily')[0].purpose);