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) Constructor Functions and Prototypes Playlist Project

were are the play and stop methods located

So im trying to go through this exercise with the prototypes but im totally confused on were the methods play and stop are coming from. Could some one explain what files these methods are in or are they coming from some were else?

I have the same question, and I'm not sure I understand the answer from Anthony below. I thought the play and stop prototypes in the song.js file are for the Song constructor.

How does the browser know to reference the Song.prototype.play, rather than the Playlist.prototype.play defined in playlist.js?

Is there only one prototype.play for all constructors? And we're just adding to prototype.play in playlist.js?

I'm not sure my question makes any sense.

2 Answers

They are coming from the prototypes declared in the song.js file.

thanks for the reply i had figured this out a few days ago i just had to get a better understanding of prototypes