Created
October 7, 2015 22:13
-
-
Save brittanmcg/f26134cb49d6cf73735c to your computer and use it in GitHub Desktop.
object with some values as objects
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
var obj = { | |
name: "Simon", | |
age: "20", | |
clothing: { | |
style: "simple", | |
isDouche: false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@elreimundo Thanks for clearing up those issues! I totally forgot to change
thing
todeepCopy
when I renamed the function haha. @konamax123 Copying in JS is rough because there are a lot of subtleties to consider when duplicating the memory allocated to objects and their contents. If you want a solution free of headaches (for the most part) consider Immutable data structures. They use structural sharing so creating "copies" isn't really that expensive. A good library is Facebooks ImmutableJS