[Home] >  Object >  Shallow copy an object

Shallow copy an object

JavaScript version

const shallowCopy = obj => Object.assign({}, obj);

// or
const shallowCopy = obj => {...obj};