filter

filter_第1张图片

let attachId = 123;
let list = [
  { attachId: 123, name: "4234" },
  { attachId: 653, name: "234123" },
  { attachId: 434, name: "433335" },
];

// 使用 filter 方法过滤出 attachId 不等于 123 的对象
let filteredList = list.filter(item => item.attachId !== attachId);

console.log(filteredList);

你可能感兴趣的:(#,js,前端)