📅  最后修改于: 2022-03-11 15:01:44.843000             🧑  作者: Mango
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);