Created
July 15, 2011 19:39
-
-
Save danesparza/1085394 to your computer and use it in GitHub Desktop.
Fun with Javascript ... pointers?
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
| // First object, with a simple string property | |
| args1 = {}; | |
| args1.test1 = "blah"; | |
| // Second object, 'created' from the first | |
| args2 = args1; | |
| // As you might expect... | |
| // args2.test1 is "blah" | |
| // Set the property to something different | |
| // on the second object | |
| args2.test1 = "boo!"; | |
| // But wait -- the objects are linked! | |
| // args1.test1 is now "boo!" too! | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment