MCPcopy Create free account
hub / github.com/SuperSimpleDev/javascript-course / renderTodoList

Function renderTodoList

1-exercise-solutions/lesson-11/11x.js:12–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10renderTodoList();
11
12function renderTodoList() {
13 let todoListHTML = '';
14
15 for (let i = 0; i < todoList.length; i++) {
16 const todoObject = todoList[i];
17 //const name = todoObject.name;
18 //const dueDate = todoObject.dueDate;
19 const { name, dueDate } = todoObject;
20 const html = `
21 <div>${name}</div>
22 <div>${dueDate}</div>
23 <button onclick="
24 todoList.splice(${i}, 1);
25 renderTodoList();
26
27 // Whenever we update the todo list, save in localStorage.
28 saveToStorage();
29 " class="delete-todo-button">Delete</button>
30 `;
31 todoListHTML += html;
32 }
33
34 document.querySelector('.js-todo-list')
35 .innerHTML = todoListHTML;
36}
37
38function addTodo() {
39 const inputElement = document.querySelector('.js-name-input');

Callers 2

11x.jsFile · 0.70
addTodoFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected