I’ve been following the Learn Web Development track and this is my first time on the forums.
Understanding Object prototypes and inheritance has been a super confusing journey so far. In this article we’re supposed to set Teacher()'s prototype and set constructor reference. A few questions:
- Why is the below code necessary after we’ve defined a Teacher constructor function using Person.call in the function body?
Teacher.prototype = Object.create(Person.prototype);
- Why can’t we do this instead?
Teacher.prototype = Person.prototype;
Apologies if this is a noob question, I just haven’t been able to wrap my head around this.