qvu8lw
Last Updated: February 25, 2016
·
1.025K
· sukima
A33233f156a5531707f130c28565de69

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()
Say Thanks
Respond

2 Responses
Add your response

9289
Icflorescu

Never thought about it, but now it seems logical ;-)

over 1 year ago ·
17310
425e381d15bd29d30f85d7530293b7fa

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 ·