Created
February 24, 2015 19:50
-
-
Save aesnyder/fe0fe90489ee2c377f8d to your computer and use it in GitHub Desktop.
Object by reference javascript coffeescript example
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
#without clone | |
car = type: 'buick' | |
newCar = car | |
newCar.type = 'honda' | |
car.type #honda | |
newCar.type #honda | |
# with clone | |
car = type: 'buick' | |
newCar = _.clone car | |
newCar.type = 'honda' | |
car.type #buick | |
newCar.type #honda |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment