Javascript 如何通过数组的索引值删除数组的元素

Javascript 如何通过数组的索引值删除数组的元素,javascript,arrays,json,Javascript,Arrays,Json,我需要根据数组的索引值删除数组的一个元素。我已经有了索引值,我只需要拼接它。customSeriesIndexMatch是我需要从customSeriesSums.data中删除的索引号 所以只需使用以下方法: 所以只需使用以下方法: 看看这本书 customSeriesSums[0]。data.splice customSeriesIndexMatch,1 查看下面的链接 customSeriesSums[0]。data.splice customSeriesIndexMatch,1 var

我需要根据数组的索引值删除数组的一个元素。我已经有了索引值,我只需要拼接它。customSeriesIndexMatch是我需要从customSeriesSums.data中删除的索引号

所以只需使用以下方法:

所以只需使用以下方法:

看看这本书

customSeriesSums[0]。data.splice customSeriesIndexMatch,1

查看下面的链接

customSeriesSums[0]。data.splice customSeriesIndexMatch,1

var dataPointSum = 101100;
console.log(customSeriesSums[0].data);

 // loop through customSeriesSums and match with dataPointSum
    var index = customSeriesSums[0].data.indexOf(dataPointSum);
    var customSeriesIndexMatch = index + 1
   console.log("DataPointSum : " + dataPointSum + " " + "Matched with customSeriesSum Index : " + customSeriesIndexMatch);

 // now I need to remove the customSeriesSums.data array by its index that equals customSeriesIndexMatch
customSeriesSums[0].data.splice( customSeriesIndexMatch, 1 );