I have this javascript / jQuery code:
var json = [
{
id: 0,
text: 'enhancement'
},
{
id: 1,
text: 'bug'
},
{
id: 3,
text: 'invalid'
},
{
id: 4,
text: 'wontfix'
}
];
delete json[2]
console.log(json)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
This code delete the array key 2. But I need an reindex after that, so that I can access the other 3 values like:
json[0]
json[1]
json[2]
How can I realize this ?