let list = [1, 2, 3]
list.splice(list.indexOf(2), 1)
// [1]
console.log(list)
and
let list = [1, 2, 3],
idx = list.indexOf(2)
list.splice(idx, 1)
// [1, 3]
console.log(list)
What"s the difference between ?
tried several more times, but there was no difference. Maybe there was something wrong with the execution before.