Skip to content

Instantly share code, notes, and snippets.

@shahab570
Last active January 7, 2021 14:09
Show Gist options
  • Save shahab570/b79cef9f0b5eee124ce79042d271151d to your computer and use it in GitHub Desktop.
Save shahab570/b79cef9f0b5eee124ce79042d271151d to your computer and use it in GitHub Desktop.
class Person {
constructor(name, gender) {
this.name = name;
this.gender = gender;
}
getGender() {
return this.gender;
}
}
class Programmer extends Person {
constructor(name, gender, hobby) {
super(name, gender);
this.hobby = hobby;
}
myhobby() {
console.log("My hobby is " + this.hobby);
}
}
let john = new Programmer("John adam", "male", "making software");
console.log(john.myhobby()); //My hobby is making software
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment