Remove last object of array and adjust indexes of the rest
xxxxxxxxxx
const a = [
{index:1, a: 10, b: 20},
{index:2, a:10, b:30},
{index:3, a:5, b:10},
]
const b = Object.assign([], {a.filter(x => x.index !== 2).map(x => {if (x.index > 2){ x.index -=1} return x})})
console.log(a);
console.log(b);