Skip to content

Instantly share code, notes, and snippets.

@ashwinkumar2438
Created June 20, 2021 11:46
Show Gist options
  • Save ashwinkumar2438/1ffaa6b0baebedb57c78e79995b400a6 to your computer and use it in GitHub Desktop.
Save ashwinkumar2438/1ffaa6b0baebedb57c78e79995b400a6 to your computer and use it in GitHub Desktop.
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