B
B
Banan442020-05-04 14:38:09
JavaScript
Banan44, 2020-05-04 14:38:09

Why is the class method not visible?

class Auto {
  constructor(runEngine) {
    this.runEngine = runEngine
  }
  runEngine() {
    this.runEngine = true
  }
}

class Bentley extends Auto {
  constructor(model) {
    super(false)
    this.model = model
  }
  runEngine() {
    super.runEngine()
    console.log('Система бентли говорит: Двигатель успешно запущен!')
  }
}

const car = new Bentley('Bentley Continental GT V8')
car.runEngine() //  is not a function

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lynn "Coffee Man", 2020-05-04
@Banan44

You have runEngine both a function (method) and a boolean property

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question