Created
February 17, 2013 19:44
-
-
Save robertwalsh0/4973061 to your computer and use it in GitHub Desktop.
Fat arrow?
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
firstname = "fatArrow other person" | |
bill = | |
firstname: 'skinnyArrow Bill' | |
lastname: 'williams' | |
skinnyArrow: -> console.log @firstname | |
fatArrow: => console.log @firstname | |
bill.skinnyArrow() #bound to the object in which it's called. hence it returns the firstname property of the "bill" object | |
bill.fatArrow() #bound to object CONTEXT because bill is in the window context, ie. window.bill |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment