I am new to js class concept.I am trying to learn about it .Here i have a problem for you guys .when ever i declare a constructor function inside child class i get a
uncaught referenceError: This is not defined error
if i can not define a constructor inside child class then how i can instantiate private property of child class inside class body?
class Parent{
constructor(){
this.parent='i am parent';
this.realactivity='do nothing :p';
}
activity(){
console.log(this.realactivity);
}
}
class Child extends Parent{
constructor(){
this.realactivity='do not listen to my parents :p';
}
activity(){
super.activity();
console.log('obeying the parent');
}
}
var child1=new Child();
child1.activity();