Created
April 10, 2020 15:38
-
-
Save r37r0m0d3l/9eded951d69b0a402ac8388356a40e8c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class Parent { | |
| constructor() { | |
| if (new.target === Parent) { | |
| console.log("This is parent class"); | |
| } | |
| else { | |
| console.log("This is extended child class"); | |
| } | |
| } | |
| } | |
| class Child extends Parent {} | |
| const parent = new Parent(); | |
| const child = new Child(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment