1

You can use Array.prototype.map() to modify the index property of the filtered result:
const data = [
{
name: "Peter",
age: 20,
nationality: "American",
index: 0
},
{
name: "David",
age: 25,
nationality: "English",
index: 1
},
{
n...