我希望test [0]不受影响,但我想从函数中删除test [1]。这就是我想到的。
var example = function(data){
this.information = data;
delete this;
return this;
}
test[1] = example("hello");
答案 0 :(得分:1)
Array.splice
是你的朋友。
var arr = ["a", "b", "c", "d"];
arr.splice(1, 1);
// Output: ["a", "c", "d"]
进一步阅读:https://msdn.microsoft.com/library/wctc5k7s%28v=vs.94%29.aspx