我有一个对象数组,想要移除其中的某个元素。然而,splice方法似乎返回的是被移除的元素,而不是移除目标元素后的新数组。
以下是我的代码:
var TheArray = TheObject.Array;
TheArray = TheArray.splice(TheIndex, 1); //TheIndex is the index of the element I want to remove
TheObject.Array = TheArrray;
当我调试并运行此代码时,TheObject.Array包含我想要删除的元素。我哪里做错了?感谢您的建议。