259 B
259 B
Shallow clone object
Use Object.assign() and an empty object ({}) to create a shallo clone of the original.
const shallowClone = obj => Object.assign({}, obj);
/*
const a = { x: true, y: 1 };
const b = shallowClone(a);
a === b -> false
*/