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.
i am not sure why it is saying unexpected end of input when i try to run the program.
when I call my print function and put var html into it is is saying unexpected end of input
Steven Parker210,475 Points
It looks like a closing brace is missing at the end of the "printlist" function. It should go on or near line 14.
Your listHTML variable is declared inside of your printlist function but you are updating it and then returning it outside of that function. You may try moving those two lines of code into your function preceding the final curly brace.
Ah I figured it out. You also were missing a closing curly brace after your printlist function which was causing your program to think that the closing curly brace for printlist was the closing bracket for your final for loop. Here's the code with the correction. This works fine. See my previous comment as well though. You will need to move
listHTML += '</ul>'; and
return(listHTML) inside your printlist function.
Thanks so much for all your help guys. It was originally a closing curly brace on my print list function that was causing the problem. Ben thanks for the information about declaring variables I will keep that in mind when creating new variables! correct me if I am mistaken but if you put the listHTML += '</ul>'; inside the for loop it will print out </ul> between each list item which wont print out correctly. Also when you see undefined print out on the web page it is being caused by the <p> tags at the bottom when I was creating the string. I just removed them and it doesn't appear on the page anymore.