what is different between Object.create(functionname.prototype) vs new Student() constructor call.
function Student(name){
this.name = name;
}
function UniversityStudent(id){
this.id= id;
}
// 1st way
UniversityStudent.prototype = Object.create(Student.prototype);
var std = new UniversityStudent(123);
// but I cannot access std.name why ?
// 2nd way
UniversityStudent.prototype = new Student("Lasith Malinga");
var std1 = new UniversityStudent(123);
// When I use std1.name now then it can
When I use 1st way then I cannot access Student`s object properties, but I use 2nd way it can, What is difference. I think both way are same... Is it wrong ?