Skip to content

Instantly share code, notes, and snippets.

@aesnyder
Created February 24, 2015 19:50
Show Gist options
  • Save aesnyder/fe0fe90489ee2c377f8d to your computer and use it in GitHub Desktop.
Save aesnyder/fe0fe90489ee2c377f8d to your computer and use it in GitHub Desktop.
Object by reference javascript coffeescript example
#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