Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Object-Oriented JavaScript (2015) Prototypal Inheritance Building the Movie Object

What happens if we don't use prototypal inheritance for this?

For this task, how will the code be like if we don't use prototypal inheritance? How difficult will it be if we were to add another object (for e.g., tv series) without using prototypal inheritance?

Would greatly appreciate it if someone could explain, in simple terms, the benefits of using prototypal inheritance.

Thanks!

1 Answer

Steven Parker
Steven Parker
231,269 Points

Methods added to the prototype become immediately available to all existing instances of an object class. Those added to the constructor will only be available to new instances created later.

Also, all instances share the same prototype code (saving memory), but any code created in the constructor will be replicated in each instance.