I've some code like
function Vehicle(){
this.isMovable = true;
}
Vehicle.prototype = {
hasTyres:function(){ return true;},
needsFuel:true
};
var Car = function(){
Vehicle.call(this);
this.type = "Car";
};
Now
It works even if I create prototype like this
Car.prototype = Object.create(Vehicle.prototype);
or
Car.prototype = Vehicle.prototype;
What is the difference ?
I was under the impression that
Car.prototype = Object.create(Vehicle);
will cause Car to inherit from vehicle ,but it's not.
Can anyone explain what's happening inside Object.create method
Thanks, SRK