Skip to content

Instantly share code, notes, and snippets.

@ivankisyov
Last active December 24, 2018 12:27
Show Gist options
  • Save ivankisyov/c6b0642118b6c79b1c5a6a6aed73de12 to your computer and use it in GitHub Desktop.
Save ivankisyov/c6b0642118b6c79b1c5a6a6aed73de12 to your computer and use it in GitHub Desktop.
"Inheritance" in JS

"Inheritance" in JS

class Human {
    constructor(name) {
        this.name = name
    }
   
}
class Man extends Human {
    constructor(name) {
    	super(name); // super points back to Human "class"
        this.gender = "male"
    }
}
class Woman extends Human {
    constructor(name) {
	super(name);
        this.gender = "female"
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment