function clone(obj) { let clone = {}; for(let i in obj){ if(obj[i] != null && typeof(obj[i]) == "object") clone[i] = clone(obj[i]) else clone[i] = obj[i]; } return clone; }
Pro tip: use ```triple backticks around text``` to write in code fences