Created
December 10, 2018 23:08
-
-
Save zfz/807cfce4bb65b619129cdcee0e909e8f 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
> const _ = require('lodash'); | |
> obj = {'a': {'b': [1,2,3]}} | |
{ a: { b: [ 1, 2, 3 ] } } | |
> obj1 = _.cloneDeep(obj); | |
{ a: { b: [ 1, 2, 3 ] } } | |
> obj1.a.b.push(4) | |
> obj | |
{ a: { b: [ 1, 2, 3 ] } } | |
> obj1 | |
{ a: { b: [ 1, 2, 3, 4 ] } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment