not deep clone

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;
}
by Luka Tatarishvili
4 years ago
JavaScript
Objects tutorial 6
0
Pro tip: use ```triple backticks around text``` to write in code fences