const test = () => { const arr = new Set(['77127026', '77127025']) const array = [ { id: '77127026', }, { id: '77127025', }, ] // eslint-disable-next-line unicorn/no-for-loop for (let index = 0; index < array.length; index++) { arr.has(array[index].id) && array.splice(index, 1) } console.log('array===>', array)}

https://blog.csdn.net/weixin_42379371/article/details/118892255?utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2~aggregatepage~first_rank_ecpm_v1~rank_v31_ecpm-2-118892255-null-null.pc_agg_new_rank&utm_term=js%E4%B8%ADfor%E5%BE%AA%E7%8E%AF%E5%88%A0%E9%99%A4%E6%8C%87%E5%AE%9A%E6%95%B0%E6%8D%AE%E3%80%81&spm=1000.2123.3001.4430