how to clone an object

JavaScript
var x = {myProp: "value"};
var xClone = Object.assign({}, x);

//Obs: nested objects are still copied as reference.const first = {'name': 'alka', 'age': 21} 
const another = Object.assign({}, first);
Source

Also in JavaScript: