i been playing with inheratance in javascript and right now i been playing with Object.create, and i got this scenerio
var Car = function() {
this.constructor = function(value) {
this._val = value;
this.accelerate = false;
};
};
Car.prototype.accelerate = function() {
this.accelerate = true;
};
Car.prototype.getVal = function() {
return this._val;
};
var myCar = Object.create(Car);
if i try myCar.getVal() don't work, i get an error saying that the method don't exist in that object? why this happens? and finally which is the right way to use Object.create()?
best regards.