Answers for "Spread Operator in object"

0

Spread Operator in object

let object1 = {
    firstName: "Nishant",
    age: 24, 
    salary: 300,
}

let object2 = {
    lastName: "Kumar",
    height: '20 meters',
    weight: '70 KG'
}

let object3 = {...object1, ...object2}
console.log(object3);
Posted by: Guest on September-17-2021
1

spread operator javascript object

let obj1 = { foo: 'bar', x: 42 };
let obj2 = { foo: 'baz', y: 13 };

let clonedObj = { ...obj1 };
// Object { foo: "bar", x: 42 }

let mergedObj = { ...obj1, ...obj2 };
// Object { foo: "baz", x: 42, y: 13 }
Posted by: Guest on December-29-2020

Code answers related to "Spread Operator in object"

Code answers related to "Javascript"

Browse Popular Code Answers by Language