var array = [
{ name:"string 1", value:"this", other: "that" },
{ name:"string 2", value:"this", other: "that" }
];
var foundValue = array.filter(obj=>obj.name==='string 1');
console.log(foundValue);
let users = [
{
name: 'John',
age: 20,
},
{
name: 'Richard',
age: 25,
}
];
let names = users.map(user => user.name);
// ['John', 'Richard]
const search = what => array.find(element => element.name === what);
let itemYouWant = null;
array.forEach((item) => {
if (item.name === 'string 1') {
itemYouWant = item;
}
});
console.log(itemYouWant);