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

currentSong.play is not a function

On the Making the UI work section, I keep getting currentsong.play is not a function, this happens when I click on the play AND next but, but not the stop button, it seems to work okay, but they all appear to be identical (I only changed values). I have no idea what's up and I've look at it for so long now that it might as well be gibberish.

Can anyone help?

var playlist = new Playlist();

var Broken = new Song("Walk", "Pantera", "4:33");
var Aenima = new Song("Aenima", "Tool", "6:33");

playlist.add(Broken);
playlist.add(Aenima);

var PlaylistElement = document.getElementById("playlist");

playlist.renderInElement(PlaylistElement);

var playButton = document.getElementById("play");
playButton.onclick = function() {
  playlist.play();
  playlist.renderInElement(PlaylistElement);
}

var nextButton = document.getElementById("next");
nextButton.onclick = function() {
  playlist.next();
  playlist.renderInElement(PlaylistElement);
}

var stopButton = document.getElementById("stop");
stopButton.onclick = function() {
  playlist.stop();
  playlist.renderInElement(PlaylistElement);
}

Are there any functions called play or next in the Playlist class?

We'd really need to see the code for the other classes (I think the problem is in the Song class) to help out.