删除数组中的某一项

1 // 删除数组中某一项,传入数组和要删除的项
2 const delArrItem = (arr, item) => {
3   let index = arr.indexOf(item)
4 
5   // 短路表达式,前面的为true才会执行后面的
6   index != -1 && arr.splice(index, 1)
7 }
原文地址:https://www.cnblogs.com/web-xu/p/11769775.html