Created
November 4, 2012 05:12
-
-
Save starkhorn/4010409 to your computer and use it in GitHub Desktop.
New person with function block in coffeescript
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
class Person | |
constructor: (block) -> | |
block.call this | |
about: -> | |
"My name is #{@name}, I am #{@age}" | |
me = new Person -> | |
this.name = "Ohm" | |
this.age = 25 | |
console.log "About me => #{me.about()}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment