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
Help!!! this is complicated
Dario Bahena10,697 Points
Imagine an apple. If you imagined a red one, someone else might have imagined a green one. When you pick an apple from a tree whatever color it may be, that is an instance of an apple. the prototype is a property that all instances of objects have that is shared among them. The prototype can be modified on the object itself and will affect all of the instances of that object but only in that special prototype property.
Array.prototype // this contains a bunch of methods including map, pop, push
const foo = [1,2,3,4]
foo.prototype // this will contain the same methods as Array.prototype
Array.prototype.test = 'whatever' // the test property is now available to all arrays
foo.test // this now works because it is part of the prototype and will be there in any array you create
Side note, this just illustrates a point. It is bad practice to mutate built in prototypes.