javascript prototype inheritance using constructor

36 Views Asked by At

There are person class and student class. And student wants to inherit person property using only prototype. How i can use prototype to inherit fname, lname.

function Person(fname, lname){
  this.fname = fname;
  this.lname = lname 
}

function student(sid){
  this.sid = sid;
}

var s = new student("John","joy", 12);
console.log(s.name);
0

There are 0 best solutions below