Skip to content

Instantly share code, notes, and snippets.

@r37r0m0d3l
Created April 10, 2020 15:38
Show Gist options
  • Select an option

  • Save r37r0m0d3l/9eded951d69b0a402ac8388356a40e8c to your computer and use it in GitHub Desktop.

Select an option

Save r37r0m0d3l/9eded951d69b0a402ac8388356a40e8c to your computer and use it in GitHub Desktop.
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