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 trialLeo Marco Corpuz
18,975 PointsI left out the </li> and code still works?
var xhs=new XMLHttpRequest(); xhs.onreadystatechange=function(){ if(xhs.readyState===4){ var roomResponse=JSON.parse(xhs.responseText); var roomHTML='<ul class="rooms">' for(var i=0;i<roomResponse.length;i+=1){ if(roomResponse[i].available===true){ roomHTML+='<li class="empty">'} else{ roomHTML+='<li class="full">'} roomHTML+=roomResponse[i].room; } roomHTML+="</ul>"; document.getElementById('roomList').innerHTML=roomHTML
}
}
xhs.open('GET','../data/rooms.json'); xhs.send();
1 Answer
Steven Parker
231,236 PointsBrowsers generally ignore HTML errors, and this may work either for or against your intentions. In the case of a missing end tag for a list element, you often see what you intended anyway.
But it is a "best practice" to always use proper syntax even if you know the bad syntax will still work.