I am sure what I am trying to accomplish can be done in a much simpler way. I unpack multiple fields and then I add the filtered object to an array.
const filteredPersons = [];
const {state, name, age, weight, gpa, diet} = person;
filteredPersons.push({state, name, age, weight, gpa, diet});
When I try something like this, it does not work:
const filteredPerson = {state, name, age, weight, gpa, diet} = person;
filteredPersons.push(filteredPerson);
This causes repetition and it looks really ugly.