I'm exploring ways to add more elements to an object, but I'm uncertain about the process.
My attempts to push data into the object have been unsuccessful.
people = [{
name: 'robert',
year: 1993
}];
//I aim to achieve this
people = {
name: 'joe',
year: 1992
}
//I want it to function as follows
people = [{
name: 'robert',
year: 1993
}, {
name: 'joe',
year: 1992
}];
I desire the capability to access it using people[0].name