Q:

Write a JavaScript program to create a shallow clone of an object

0

Write a JavaScript program to create a shallow clone of an object. 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

const shallowClone = obj => Object.assign({}, obj);
const a = { x: true, y: 1 };
const b = shallowClone(a);  

console.log(b);

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now