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