Lets say I have this simple object:
var User = {
name: 'Hans',
get_name: function(){return this.name},
street: 'Kings',
postcode: '482932',
city: 'New York'
}
For a better overview, I would like to do something like this:
var User = {
name: 'Hans',
get_name: function(){return this.name},
};
//Adress Information
User.add({
street: 'Kings',
postcode: '482932',
city: 'New York'
});
As expected this doesn´t work. To achieve somthing similar I could write:
User.street = 'Kings';
User.postcode = '482932';
.......
But I would like to add several attributes at the same time. Is there a handy function for it? Thanks