How do i achieve this :
function Vehicle(){
this.mobility = true;
};
function Car(){};
Car.prototype = new Vehicle();
var myCar = new Car();
console.log(myCar.mobility);
Using objects created with Object literals ?
I know about Object.create() but is there any way like
Car.prototype = new Vehicle();
to achieve that ?
Here’s how you do it using
__proto__:That being said, I would avoid doing this. It looks like it is deprecated