i = 0; i < todoItems.length; i++) { var item = todoItems[i]; html += "<li>"; if (item.completed) { html += "<del>" + item.title + "</del>"; } else { html += item.title; } html += "</li>"; } list.innerHTML = html;
= document.getElementById("todos"); var html = ""; for (var i = 0; i < todoItems.length; i++) { var item = todoItems[i]; var template = item.completed ? completedItem : incompleteItem; html += template.replace("{{title}}", item.title); } list.innerHTML = html;