📅  最后修改于: 2022-03-11 15:03:11.439000             🧑  作者: Mango
const array = [2, 5, 9];
console.log(array);
const index = array.indexOf(5);
if (index > -1) {
array.splice(index, 1);
}
// array = [2, 9]
console.log(array);
Run code snippet