Skip to content

Instantly share code, notes, and snippets.

@jjgonecrypto
Created August 24, 2012 15:16
Show Gist options
  • Save jjgonecrypto/3451895 to your computer and use it in GitHub Desktop.
Save jjgonecrypto/3451895 to your computer and use it in GitHub Desktop.
little coffeescript class quiz
class Person
info: {}
setName: (name) -> @info.name = name
justin = new Person()
justin.setName "justin"
paul = new Person()
@michaelficarra
Copy link

{name: "justin"}, obviously. You've shared it on the prototype. If you wanted an own-property, you'd need to make a new one in the constructor for each instance. Basic understanding of the JS prototype system would have told you that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment