另一种是使用 filter() 函数:

let arr = [1, 2, 3, 4, 5];
arr = arr.filter(item => item !== 3);

你可以根据自己的需求选择合适的方法。

    • 5891
    4年前
  •