Skip to content

Instantly share code, notes, and snippets.

@tuvo1106
Created November 20, 2018 20:09
Show Gist options
  • Save tuvo1106/ea9e3c59ed23c28d3acaa8d32e8d941a to your computer and use it in GitHub Desktop.
Save tuvo1106/ea9e3c59ed23c28d3acaa8d32e8d941a to your computer and use it in GitHub Desktop.
let ex = ['a', 'b', 'c']
let ex1 = [['a','b'], [['c']]]
let ex2 = {
a: 1,
b: 2,
c: 3
}
let ex3 = {
a: [1,2,3, {g: 6, h: 7}],
b: {
d: 4,
e: 5
},
c: {
f: [6,7,8]
}
}
console.log(deepClone(ex)) // [ 'a', 'b', 'c' ]
console.log(deepClone(ex1)) // [ [ 'a', 'b' ], [ [ 'c' ] ] ]
console.log(deepClone(ex2)) // { a: 1, b: 2, c: 3 }
console.log(deepClone(ex3)) // { a: [ 1, 2, 3 ], b: { d: 4, e: 5 }, c: { f: [ 6, 7, 8 ] } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment