Answers for "filter array of objects javascript by value and id get leargest value of each id"

4

javascript filter array of objects by id

const myArray = [{id: 1, name:'pipi'}, {id: 2, name:'popo'}];
const id = 2;

const variableOne = myArray.filter(itemInArray => itemInArray.id === id);
console.log(cariableOne[0].name);
Posted by: Guest on February-01-2021

Code answers related to "filter array of objects javascript by value and id get leargest value of each id"

Code answers related to "Javascript"

Browse Popular Code Answers by Language