In my Angular2 app I am trying to figure out how to push a new object into an array that contains objects with three properties - when I only want to push one of those three properties. Take this array for instance:
locations = [
{ city: 'Los Angelas', zipcode: '90001', coordinates: 2321 },
{ city: 'New York', zipcode: '10001', coordinates: 3432 },
];
Here I want to ONLY push new zipcodes - not city names or coordinates. So, I'm assuming it would look like this after pushing a new object:
locations = [
{ city: 'Los Angelas', zipcode: '90001', coordinates: 2321 },
{ city: 'New York', zipcode: '10001', coordinates: 3432 },
{ zipcode: 20001 }
];
How would I handle this? Can I do this? Or would I need to pass null values for the other two properties?