For example:
class Car(){ weight(){ alert('100kg'); } getWeight(){ this.weight() //не работает } } How to do it right?
For example:
class Car(){ weight(){ alert('100kg'); } getWeight(){ this.weight() //не работает } } How to do it right?
It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:
This question should be closed, because problem caused by typo
class Car { weight(){ alert('100kg'); } getWeight(){ this.weight() //не работает } } (new Car()).getWeight(); class Car { weight() { console.log('100kg'); } getWeight(){ this.weight(); } } var car = new Car; car.getWeight(); Source: https://ru.stackoverflow.com/questions/679191/
All Articles
class Car- DreamChild