Assigning a CoffeeScript class to a property
Did you know you can assign a class to a property or variable in CoffeeScript?
MyObject =
property1: "value1"
property2: class
constructor: (@instance_var) ->
instance_fn: ->
test_var = new MyObject.property2()
Written by Devin Weaver
Related protips
2 Responses
Never thought about it, but now it seems logical ;-)
over 1 year ago
·
Why you would want to instantiate a whole new object class on the inside of a singleton I have no idea...
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Coffeescript
Authors
iam4x
94.17K
ericdfields
63.02K
Related Tags
#coffeescript
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#