- 1
I have error undefined console. Thanks you.
Undefined console. https://code.sololearn.com/W2C8IWM7kSsH/?ref=app
3 ответов
+ 2
A function should return a value before output can obtain the value.
return car.mileage += miles;
0
Missing return statement.
drive: function (miles) {
return car.mileage += miles;
}
0
Because the drive function aren't returning anything.That's why printing the function will become undefined.If you want to return the car.mileage, use
return car.mileage;
Here is the solution:
https://code.sololearn.com/WA23A18A0A19