Last active
May 11, 2022 02:45
-
-
Save dvdrtrgn/8efb90d91d961eb544ee3a5226439c4f to your computer and use it in GitHub Desktop.
Extended Class order of inits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
let C = console; | |
class C0 { | |
constructor() { | |
C.log(`C0 construct’d`); | |
C.log(`C0 this’d`, this); | |
} | |
foo = (() => C.log(`C0 init`))() || `C0 init`; | |
} | |
class C1 extends C0 { | |
constructor() { | |
C.log(`C1 construct’d`); | |
C.log(`C1 super’d`, super()); | |
} | |
foo = (() => C.log(`C1 init`))() || `C1 init`; | |
} | |
class C2 extends C1 { | |
constructor() { | |
C.log(`C2 construct’d`); | |
C.log(`C2 super’d`, super()); | |
} | |
foo = (() => C.log(`C2 init`))() || `C2 init`; | |
} | |
new C2(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "class-order-of-inits", | |
"version": "1.0.0", | |
"bin": "./index.js" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment