let val = 1;
let list = [
    {id:1,name:'张三'},
    {id:2,name:'李四'},
    {id:3,name:'王五'},
];

let arr = list.filter((i) => {
  return val == i.id;
});

Logo

前往低代码交流专区

更多推荐