Hey there!
Currently, I am tackling the task of manipulating my Array by inserting objects at index 0 with the push method and eliminating items using splice. As per my understanding, when you splice an item from an array, it should not result in an 'undefined' item being left behind. However, I seem to be facing this issue as 'undefined' items are appearing when I use splice.
Below is the code snippet for adding entries:
addOrRemoveRating(0,0,{
rating : 0,
tran_number : transaction_number,
email : $scope.called_numbers[0].email
});
And here is the code snippet for removing entries:
addOrRemoveRating(array_index,1);
where the array_index represents an existing index.
The part where the splicing takes place is shown below:
addOrRemoveRating = function(index, item, object){
$scope.temp_called_numbers.splice(index, item, object);
}
For instance, if we have an array with 3 objects - [Object, Object, Object], after deleting an item, it ends up becoming - [Object, Object, undefined].
Could you please point out if there's something missing or incorrect in the code? Any assistance, guidance, or advice would be highly valued.