Created
November 20, 2018 20:09
-
-
Save tuvo1106/ea9e3c59ed23c28d3acaa8d32e8d941a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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