You have written a really nice markTodo function in logic.js. 🥇
But, if the very first todo in the array meets the if condition on line 60, the loop will continue to go through the remaining todos.
for (let item of newTodos) {
if (item.id == idToMark) {
item.done ? (item.done = false) : (item.done = true);
}
}
You can add a return statement after line 61 to make the loop exit as soon as the if condition is met 👍 this will make your code run faster, especially if the todo array is very long!
You have written a really nice markTodo function in logic.js. 🥇
But, if the very first todo in the array meets the if condition on line 60, the loop will continue to go through the remaining todos.
You can add a
return
statement after line 61 to make the loop exit as soon as the if condition is met 👍 this will make your code run faster, especially if the todo array is very long!