Answers for "return all object where array has object"

62

find an object in an array of objects javascript

let arr = [
    { name:"string 1", value:"this", other: "that" },
    { name:"string 2", value:"this", other: "that" }
];

let obj = arr.find(o => o.name === 'string 1');

console.log(obj);
Posted by: Guest on May-08-2020
1

array has object with property js

myArray.some(obj => obj.property === 'value')
// returns true or false
Posted by: Guest on March-05-2021

Code answers related to "return all object where array has object"

Code answers related to "Javascript"

Browse Popular Code Answers by Language