I am working with a JSON array that contains tasks:
tasks = [{taskcode:1, taskName:'abc'},
{taskcode:2, taskName:'abc1'},
{taskcode:3, taskName:'abc2'},
.....
];
If I delete a task with the name abc
, I want the task codes of other tasks to be reindexed like this:
tasks = [{taskcode:1, taskName:'abc1'},
{taskcode:2, taskName:'abc2'},
.....
];
These tasks are added dynamically by pushing values from a popup.
Can anyone help me figure out how to achieve this?