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
Greg Schudel
4,090 PointsBoth Songs Are Getting "Current" Class, why? Other questions...
I have several questions...
Here is the first, why are my songs being coded in pink (using the current link class)? Watched the video several times and just getting lost.
Please see my files (which should be attached) for other questions.
Here is my snapsnot, my sincerest apologies for not attaching this earlier. I thought it attached automatically. :/ https://w.trhou.se/2zfc7jt1ar
Steven Parker
243,656 PointsFYI: Code (but not a snapshot) is attached automatically when you use the "Get Help" button in a challenge.
1 Answer
Keith Kelly
21,326 PointsGreg I ran into a couple issues.
First I was not getting any songs to display. I noticed that you had a typo on lines 3 & 4 of app.js. Here is what I noticed:
// Line 3 was missing Song
// Current
var beatIt = new ("Beat it", "Michael Jackson", "3:45" );
// Should be
var beatIt = new Song("Beat it", "Michael Jackson", "3:45" );
// Line 4 had an unnecessary space between Song and the parenthesis
// Current
var sweetHomeAlabama = new Song ("Sweet Home Alabama", "Leonard Skinnard", "2:57" );
// Should be
var sweetHomeAlabama = new Song("Sweet Home Alabama", "Leonard Skinnard", "2:57" );
The issue with both songs being pink comes from line 27 of the song.js. You have the "current" class being added in the if statement, but then right after the if statement you are adding it again to all songs.
// Eliminate the following from line 27 of song.js
htmlString += ' class="current"';
That should do it.
Steven Parker
243,656 PointsSteven Parker
243,656 PointsTo share your files, you can include them in your question. If you do, be sure to use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area.
 Or watch this video on code formatting.
You can also make a snapshot of your workspace and post the link to it here.
If your question is related to a course, please also provide a link to the course page you are working with.