Open medaminedev66 opened 3 years ago
form line 34 to the line 36 : https://github.com/medaminedev66/to-do-list/blob/a23a59886f003ab265a073405796096f1e0145d7/src/index.js#L34-L36 it can be changed with :
const children = [checkbox, description, removeIcon] children.forEach(child => {listContainer.appendChild(child); })
form line 67 to line 76 : https://github.com/medaminedev66/to-do-list/blob/a23a59886f003ab265a073405796096f1e0145d7/src/index.js#L79-L83 it can be changed with :
arrangeList(); iterateTasks();
Here, I used the same process twice. It's a repetition. I can define a function, and call it twice. form line 48 to line 53 : https://github.com/medaminedev66/to-do-list/blob/a23a59886f003ab265a073405796096f1e0145d7/src/tasks.js#L20-L25 and form line 20 to line 25 : https://github.com/medaminedev66/to-do-list/blob/a23a59886f003ab265a073405796096f1e0145d7/src/tasks.js#L48-L53 I can use this instead :
const updateIndex= (list) =>{ if (list.length > 0) { let i = 1; list.forEach((element) => { element.index = i; i += 1; }); }
and call it in both functions, cleanCompleted() and removeTask()
cleanCompleted()
removeTask()
form line 34 to the line 36 : https://github.com/medaminedev66/to-do-list/blob/a23a59886f003ab265a073405796096f1e0145d7/src/index.js#L34-L36 it can be changed with :
form line 67 to line 76 : https://github.com/medaminedev66/to-do-list/blob/a23a59886f003ab265a073405796096f1e0145d7/src/index.js#L79-L83 it can be changed with :
Here, I used the same process twice. It's a repetition. I can define a function, and call it twice. form line 48 to line 53 : https://github.com/medaminedev66/to-do-list/blob/a23a59886f003ab265a073405796096f1e0145d7/src/tasks.js#L20-L25 and form line 20 to line 25 : https://github.com/medaminedev66/to-do-list/blob/a23a59886f003ab265a073405796096f1e0145d7/src/tasks.js#L48-L53 I can use this instead :
and call it in both functions,
cleanCompleted()
andremoveTask()