Reputation: 6387
I need to remove a element of a array by its index value. I have the index value already I just need to splice it. The customSeriesIndexMatch is the index number that i need to remove from customSeriesSums.data
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
Upvotes: 1
Views: 50
Reputation: 2332
Check out the splice docs.
customSeriesSums[0].data.splice( customSeriesIndexMatch,1 );
Upvotes: 2