Skip to content

Instantly share code, notes, and snippets.

@NishantThapa
Created September 4, 2018 19:00
Show Gist options
  • Save NishantThapa/68552fa96b67acfb804184e5a93f274b to your computer and use it in GitHub Desktop.
Save NishantThapa/68552fa96b67acfb804184e5a93f274b to your computer and use it in GitHub Desktop.
class use in es6
class name{
constructor(a,b){
this.a =a ;
this.b = b;
}
new(){
console.log(`${this.a} and ${this.b}`);
}
}
var dummy = new name("nishant",27);
dummy.new();
// given below code will be used for extending class
class zname extends name{
constructor(){
super("arch",26)
}
}
var zdummy = new zname();
zdummy.new();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment