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.

Ken Cherry
1,147 PointsShouldn't songs.length in the for loop be playList.length since the name of the array is playList?
Shouldn't songs.length in the for loop be playList.length since the name of the array is playList? If not, please help.
var playList = [ [ "", "", ""], [ "", "", ""] ];
for( i = 0; i < songs.length; i += 1 ) { }
1 Answer

Steven Parker
215,958 PointsWhat you're saying certainly seems to go with that code snippet, but if these lines are part of a larger project, there could be other things involved. If this is from a course, please provide a link to the course page you are working with.
Omar Faruque
Full Stack JavaScript Techdegree Graduate 21,742 PointsOmar Faruque
Full Stack JavaScript Techdegree Graduate 21,742 PointsIf you want to iterate through an array named songs, then it should be songs.length. Here, I guess you want to iterate through the playList array. So, yes, it should be playList.length. By the way, use the var inside the loop conditional. Example:- for( var i = 0; i < songs.length; i += 1 ) { }