Created
August 14, 2016 13:43
-
-
Save VincentDamour/ad262422a30f1ed03d3f5cba2309710f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var original = { foo: "bar" }; | |
var copy = original; | |
copy.foo = "new value"; | |
// copy -> { foo: "new value" } Yeah! | |
// original -> { foo: "new value" } Oops! | |
var original = { foo: "bar" }; | |
var copy = _.cloneDeep(original); | |
copy.foo = "new value"; | |
// copy -> { foo: "new value" } Yeah! | |
// original -> { foo: "bar" } Yeah! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment