delete addon_categories[index];
If index is 1, this statement leaves an undefined placeholder in the array.
[{Object}, undefined]
How do I solve this?
delete addon_categories[index];
If index is 1, this statement leaves an undefined placeholder in the array.
[{Object}, undefined]
How do I solve this?
Try this:
if (index > -1) {
addon_categories.splice(index, 1);
}
Using delete
keyword, it will set undefined
, will not remove the element complete it's expected behavior.