我怎样才能实现一个与 做同样事情的函数ArrayList.remove(o)
?
我最接近的东西是
Array.prototype.remove = function(o) {
var index = this.indexOf(o);
if(index == -1) {
return;
}
return this.splice(index, index);
}
但是它在第二行引发错误,声称indexOf(o)
不存在。( cannot find function indexOf()
)