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
Need help understanding var statusHTML = '<ul class="bulleted">';
I do not understand what
var statusHTML = <ul class="bulleted">;
This comes in at about 4:00 in the video.
Dave says, "I'll create a variable to hold the HTML that the call back generates.".
Is the .bulleted pulled from anywhere else in this project?
Just to expand on what Damian said,
statusHTML is also building the
ul list. You start with typing '<ul class="bulleted">' (which is a string) and then as you get each list item in the JSON data, you are constructing and appending those list items to that
ul element by adding each list item to the variable. It is a way of dynamically adding in elements. :)
A neat experiment to try is initializing the variable
statusHTML into the global scope (place the initial line: var statusHTML = '<ul class="bulleted">'; line outside of the function) and then go into your web console (if you have Chrome or Firefox) and type out "statusHTML". You'll see it has become a pretty long string consisting of list items. :)