Es6 how to get matching objects array
Requirement is in array find objects which value is 1
const arr = [ {id:1, value:1}, {id:2, value:2}, {id:3, value:1}, {id:4, value:1} ];In result we are expecting
// [{id:1, value:1}, {id:4, value:1} ]
const result = arr.filter((item) => {
return item.value === 1;
});
Comments