I am trying to add more things inside an object but I am not sure how to do it
I have tried pushing the data into the object but it doesn't work
people = [{
name: 'robert',
year: 1993
}];
//this is what i want to add
people = {
name: 'joe',
year: 1992
}
//I want it to act as if it was
people = [{
name: 'robert',
year: 1993
}, {
name: 'joe',
year: 1992
}];
I want to be able to call it back using people[0].name
Personout for what they are.peopleas{}[]andpeopleas{}is confusing. Singular ofpeopleisPersonso tryPerson[]wherePersonis a well-defined type.