Skip to content

Instantly share code, notes, and snippets.

@sgentile
Created February 9, 2012 04:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sgentile/1777385 to your computer and use it in GitHub Desktop.
Save sgentile/1777385 to your computer and use it in GitHub Desktop.
Coffeescript static property and method
class Person
@test: (input) ->
return input
@staticProperty : 10
@get: ->
return {name:'Steve'}
nonStatic: ->
return "non static"
console.log Person.test 'Hello World'
console.log Person.get()
console.log Person.staticProperty
#console.log Person.nonStatic() this is an error
person = new Person()
console.log person.nonStatic()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment