Created
June 20, 2021 11:46
-
-
Save ashwinkumar2438/1ffaa6b0baebedb57c78e79995b400a6 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 Home{ | |
sleep(){ console.log(`${this.name} is sleeping.`) } | |
resting(){console.log(`${this.name} is resting`)} | |
static atHome(){console.log('I am at Home.')} | |
} | |
class HomeWork extends Home{ | |
constructor(name){ | |
super(); | |
this.name=name; | |
super.resting(); | |
} | |
sleep(){ | |
super.sleep(); | |
console.log('no work.') | |
} | |
static workingAt(){super.atHome();} | |
} | |
var lad=new HomeWork('lad'); //@logs "lad is resting" | |
lad.sleep(); //@logs "lad is sleeping." & "no work." | |
HomeWork.workingAt(); //@logs "I am at Home." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment