scrimba
Javascript Hacks with ES6-ES7
JavaScript Hack #09
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

JavaScript Hack #09
AboutCommentsNotes
JavaScript Hack #09
Expand for more info
index.js
run
preview
console
function clone(obj){
var objCopy = {};
for(var i in obj){
if(typeof i === "Object"){
objCopy[i]= clone(i)
} else {
objCopy[i] = obj[i]
}
}
return objCopy;
}

console.log(clone({x:90, y:{z:80}}));
Console
{x:
90
, y:
{z:
80
}
}
,
index.html
-1:11