Skip to content

Instantly share code, notes, and snippets.

@hirokiky
Last active February 4, 2019 11:27
Show Gist options
  • Save hirokiky/b0ae4a559fc6dae34eb70d4fcf9444d6 to your computer and use it in GitHub Desktop.
Save hirokiky/b0ae4a559fc6dae34eb70d4fcf9444d6 to your computer and use it in GitHub Desktop.
experiment
> class F {
... constructor (a) {
..... if (a > 0) {
....... this.child = new F(a-1)
....... }
..... }
... }
undefined
> new F(3)
F { child: F { child: F { child: F {} } } }
> new F(8)
F { child: F { child: F { child: [F] } } }
> var f = new F(8)
undefined
> f.child
F { child: F { child: F { child: [F] } } }
> f.child.child.child.child
F { child: F { child: F { child: [F] } } }
> f.child.child.child.child.child
F { child: F { child: F { child: F {} } } }
> f.child.child.child.child.child.child
F { child: F { child: F {} } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment