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 trialnagamani palamuthi
6,160 Pointschallenge solution not working:(
my code is the same as the teacher's but not working. doesnt seem to have created an array. it outputs undefined.
3 Answers
Steven Parker
231,269 PointsYour buildList function is not returning a value.
Inside the function, you construct listHtml, but there's no return statement passing it back to the caller.
Also, when you create a list item in that function, the closing li
tag is missing the slash.
listHtml += "<li>" + arr[i] + "</li>" ; // <-- note / added
Plus, you might want to add a "You got these questions wrong" header between the two calls to buildList.
john larson
16,594 Pointshtml = "You got " + correctAnswers + " " + " question(s) right" ;
html += "<h2>You got these questions right </h2>"
html += right + " " + wrong; //here I added the arrays that you pushed the correct/incorrect answers to
print(html);
nagamani palamuthi
6,160 Pointsthanks it works now. thanks for pointing out the missing statements.
john larson
16,594 Pointsjohn larson
16,594 PointsThat makes sense Steven. I bypassed the buildList function altogether cause it didn't seem to be doing anything. I didn't look to see WHY it wasn't doing anything.