Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

231
Views
Why there is a need to use Object.create() in prototype interitance

I was looking at an inheritance example using prototypes as below:

function Person(name){
   this.name = name
}

function Student(name){
  Person.call(this, name)
}
Student.prototype = Object.create(Person.prototype)
Student.prototype.constructor = Student

let jim = new Student("Jim")

My question is, why there is a need to set the prototype using Object.create(Person.prototype) Why not simply setting it like Person.prototype?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you do

Student.prototype = Person.prototype;

and next move try to extend it:

Student.prototype.a = function(....

You will be affecting Person.prototype as well(since it's strictly the same exact object after assignment)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!