Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Object-Oriented JavaScript (2015) Constructor Functions and Prototypes Playlist Project

explain what your are doing please

your are good teacher and your trying hard but at times you make it things difficult

very true...

8 Answers

this guy is a complete joke. i was happy when i finished jquery and got Dave back but now i got this guy again and his terrible ability to teach.........

Scott Cox
Scott Cox
12,219 Points

I'm still trying to wrap my head around it, but I broke down a little. In this, I only look at creating a song, adding it to the playlist, and then pressing play. I hope it helps a bit.

/* Creates a Song constructor function */
function Song(title, artist, duration) {
  this.title = title;
  this.artist = artist;
  this.duration = duration;
  this.isPlaying = false;
}

/* Creates a new Song using the Song constructor function */
var hereComesTheSun = new Song("Here Comes the Sun", "The Beatles", "2:54");

/* Creates the Playlist.songs Array and Playlist.nowPlayingIndex */
function Playlist() {
  this.songs = [];
  this.nowPlayingIndex = 0;
}

/* Creates a prototype for pushing a new song to the end of the Playlist.songs array */
Playlist.prototype.add = function(song) {
  this.songs.push(song);
};

/* Pushes a song to the end of Playlist.songs array */
playlist.add(hereComesTheSun);

/* Creates a "play" prototype for objects created using the Song constructor function */
Song.prototype.play = function() {
  this.isPlaying = true;
};

/* Creates a prototype for the playlist to use the Song.prototype.play function on the currently playing song.*/
Playlist.prototype.play = function() {
  var currentSong = this.songs[this.nowPlayingIndex];
  currentSong.play();
};

This project confused me also, there was little to no explanation of his rationale for doing anything, in the previous courses there was a planning stage that was completely left out here. Obviously he had planned ahead and knew what he was doing before he ever began and we missed out getting an idea of his thought process, for instance he creates .play and .stop methods on the playlist that each calls .play and .stop methods on the song before they were even created which I found confusing as I wasn't sure why he was calling a .play function within the .play function.

Paul K.
Paul K.
12,110 Points

yea man.. it's tough. hopefully it will come... there's so much to learn..

Yixi Guan
Yixi Guan
7,927 Points

This challenge does needs more explanation. I think one way to get through it is: before watching his solution, thinking of how we will do the project ourselves. I am going to do this right now, otherwise I feel like I am listening, understand the language, but have no idea what is going on.

Harry Beckwith
Harry Beckwith
13,452 Points

Slightly confusing, and lack of explanation. Feel as though its a huge leap compared to the previous videos in this course section. Guess it gives you an outline of how projects similar to this are built. =(

Tarek Demachkie
Tarek Demachkie
365 Points

I agree with the comments here, the instructor is assuming we know things without going into details when explaining. I have had no problem with any other course yet besides this one.

Jeremiah Lugtu
Jeremiah Lugtu
9,910 Points

In class do you just stare at your teacher? or take notes, read textbooks, do homework and projects? Is that how you learn programming? hell, no... You learn it by doing it yourself, not just following along...

If you're applying for a tech job, they won't care how many points or badges you get in treehouse, but what you have created yourself.

In the topic of this lesson, you just have to actually read and understand the code... not just follow along for the sake of it.

Paul K.
Paul K.
12,110 Points

this section goes way too fast...