I found that it could be nice if I use just 3 properties for the list instead of how it is now. I should refactor code to use only Id instead of both id and index.
addBtn.onclick = () => {
const id = id${Math.random().toString(16).slice(2)};
const description = document.querySelector('#input').value;
const completed = false;
const index = listToDo.list.length + 1;
I found that it could be nice if I use just 3 properties for the list instead of how it is now. I should refactor code to use only Id instead of both id and index. addBtn.onclick = () => { const id =
id${Math.random().toString(16).slice(2)}
; const description = document.querySelector('#input').value; const completed = false; const index = listToDo.list.length + 1;const newTask = { id, description, completed, index, }; if (description) { document.querySelector('#input').value = ''; listToDo.addToDo(newTask); renderList(listToDo); } };