Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

union of two objects javascript

let job = {
    jobTitle: 'JavaScript Developer',
    country: 'USA'
};

let location = {
    city: 'London',
    country: 'England'
};

let remoteJob = {
    ...job,
    ...location
};

console.log(remoteJob);
// Output:
{
    jobTitle: 'JavaScript Developer',
    country: 'England',
    city: 'London'
}
 
PREVIOUS NEXT
Tagged: #union #objects #javascript
ADD COMMENT
Topic
Name
8+4 =