I have an array like below:
var fields = [
{name:\"mark\", age:\"23\"},
{name:\"smith\", age:\"28\"},
{name:\"kelvin\", age:\"25\"},
{name:\"
If I am understanding this correctly you want to remove array element at index 2 and re-index the array so there is no empty space. If that's the case javascript has got you covered.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice
fields.splice(2,1); // This modifies your original array and removes only one element starting at index 2.