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 Making the UI Work

playlist instead of Playlist constructor? but why..

around the 7:10 to 7: 30 duration in the video

we can see the code uses


yet in the playlist.js file it is clear to see that the constructor is Playlist with a capital P as seen below. is this referenceing the playlist.js file is that why it is lower case?

Playlist.prototype.play = function() {
   var currentSong = this.songs[this.nowPlayingIndex]; 

Playlist.prototype.stop = function(){
  if(this.nowPlayingIndex == this.songs.length){
    this.nowPlayingIndex = 0; 


1 Answer

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

No. In app.js on the first line at the start of the video you have this line:

var playlist = new Playlist();

This creates a new instance of a Playlist object which will now be referenced to simply as playlist. In reality, you could have named this any valid JavaScript variable name. For example, myPlaylist or yourPlaylist. Those would then be referenced by those names.

Hope this helps! :sparkles: