Answers for "es6 spread assign nested object"

0

es6 spread assign nested object

const obj1 = { key1: { a: 1}}
const key1 = { b: 2};
const res = {...obj1,key1:{...obj1.key1,...key1}};
console.log(res)
Posted by: Guest on August-16-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language