Open DevaWinner opened 1 year ago
In this code snippet, I found that the logic for adding a task is duplicated. The same block of code is repeated for both the click event on addTaskButton and the keydown event on taskInput. Whereby, it doesn't pass the DRY (Don't Repeat Yourself) test. https://github.com/DevaWinner/to-do-project/blob/c16c5c284277ca4c8cd7e5e978cf03a9b5f2ff7a/src/index.js#L74-L90
To improve this code, I can extract the duplicated logic into a separate function and reuse it in both event listeners.
Overall, the rest of the code adheres to KISS and YAGNI principle by providing the required functionality without introducing unnecessary complexity or speculative features.
I will be using this issue to self asses my code for best practices using the DRY, KISS and YAGNI principles.