'how to call method in static method in javascript
how to call non static method into static method
i written this class and when run this class
class Test{
constructor(p){
this.fname = p;
}
change(n){
this.fname = n + ' test';
}
static show(){
this.change('iman');
return this.fname;
}
echo(){
return this.fname+' ok';
}
}
console.log(Test.show());
return below error
TypeError: this.change is not a function
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|