return a copy of property javascript code example
Example 1: copy object javascript
// es6
const obj = {name: 'john', surname: 'smith'};
const objCopy = {...obj};
Example 2: clone javascript object
let clone = Object.assign({}, objToClone);
// es6
const obj = {name: 'john', surname: 'smith'};
const objCopy = {...obj};
let clone = Object.assign({}, objToClone);