Last active
August 29, 2015 14:16
-
-
Save itsthatguy/48d9b47dba05b300c65b to your computer and use it in GitHub Desktop.
Coffeescript Classes: object.prototype.function and object.function demonstrated
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
# Run the following command in shell: | |
# curl -s https://gist.githubusercontent.com/itsthatguy/48d9b47dba05b300c65b/raw/80b1111bb5273697d1db4f5662eb763aa4a80cdc/foo.coffee | coffee --stdio | |
class Foo | |
name: 'abott' | |
@myFunction: -> | |
console.log "\n# start" | |
console.log "\nFoo" | |
console.log "this.name:", this.name | |
myOtherFunction: -> | |
console.log "\nfoo (instance of Foo)" | |
console.log "this.name:", this.name | |
console.log "\n# end" | |
Foo.myFunction() | |
foo = new Foo() | |
foo.myOtherFunction() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment