Skip to content

Instantly share code, notes, and snippets.

@kdabir
Created August 12, 2015 06:41
Show Gist options
  • Save kdabir/49e6f7057c4f51c2ebf3 to your computer and use it in GitHub Desktop.
Save kdabir/49e6f7057c4f51c2ebf3 to your computer and use it in GitHub Desktop.
recursive instantiation in constructor in coffee
class A
constructor: (@a)->
if @a>0 then @child = new A(@a-1)
console.log new A(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment