Answers for "how to get particular key value from array of objects in javascrip"

0

how to get particular key value from array of objects in javascrip

const search = what => array.find(element => element.name === what);
Posted by: Guest on January-26-2022
0

how to get particular key value from array of objects in javascrip

let itemYouWant = null;
array.forEach((item) => {
    if (item.name === 'string 1') {
        itemYouWant = item;
    }
});
console.log(itemYouWant);
Posted by: Guest on January-26-2022
0

how to get particular key value from array of objects in javascrip

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);
Posted by: Guest on January-26-2022

Code answers related to "how to get particular key value from array of objects in javascrip"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language