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 trialalex gwartney
8,849 Pointswere 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?
2 Answers
Anthony Attard
43,915 PointsThey are coming from the prototypes declared in the song.js file.
alex gwartney
8,849 Pointsthanks for the reply i had figured this out a few days ago i just had to get a better understanding of prototypes
Kevin Bullis
13,770 PointsKevin Bullis
13,770 PointsI 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.