194
I have two objects,
const p = { name: "Ajay", age: 20, }; const q = { branch: "CSE", };
I want to merge these two to a single object like below, how to do it?
const r = {...p, ...q}; console.log(r);
Ouput,
{ name: 'Ajay', age: 20, branch: 'CSE' }