0

What is the difference between using the 'new' key word in a constructor's prototype property to create inheritance and the Object.create? Is one better then other?

function Employee(){
     this.pay=500;
  }

function Manager(){
     this.reports=[1,2,3,4];
 }
 Manager.prototype=Object.Create(Employee.prototype);
 Manager.pay+=100;

// or the using new to construct a new object

function Manager(){
     this.reports=[1,2,3,4];
 }
 Manager.prototype= new Employee();
 Manager.pay+=100;
Brandon
  • 1,099
  • 1
  • 9
  • 14

0 Answers0