0

So i have two objects

var Vehicle = { 
      type:"4 wheel vehicle",
      run: function(){
        console.log(this.type + " is running.";
      }
    }
                    
var Car = {
      type:"Car"
    }         
                        
                    
What should i do to assign the Prototype chain, so if I am running

Car.run();

This should print "Car is running", I know i can definitely do

var Car = Object.create(Vehicle);

Car.type = "Car";

Car.run();
Do i have another way to assign the prototype chain, once the object is already created.
jforjs
  • 465
  • 1
  • 4
  • 11

0 Answers0