Undefined at beginning of list?
Any idea why I'm getting an undefined at the front of this list?
Grzegorz Zielinski5,838 Points
It's because at the very beginning of your script you have not defined any value for variable 'html' (var html;), and because of that when you print your message to page you end up with "undefined" word at the beginning of your list (your loop adds all the paragraphs to html which starting value is "undefined" so you and up with something like 'undefined += <p>...</p> etc.).
To make it work you just simply need to define any value, even empty brackets to your html variable:
var html = '';
It will solve the problem.
Zimri Leijen11,588 Points
Because html is undefined when you replace the body with it.
document.querySelector('body').innerHTML = html;
By the way, you overwrite the h1 as well.
My suggestion would be to append instead of overwriting (
+= instead of =) and make sure html isn't undefined when you declare it (make it an empty string instead, so
var html = '')