maximoortelli / To-Do-list-

MIT License
0 stars 0 forks source link

To Do List: Follow the Best Practices #3

Open maximoortelli opened 1 year ago

maximoortelli commented 1 year ago

Areas I could optimize my To Do List project to improve readability, maintainability and performance:

  1. Separation of concerns: I could split my code into smaller functions that handle specific tasks. This would make my code easier to

  2. Event delegation: Instead of attaching individual click event listeners to each "Options" button and "Trash" image, you could use event delegation.

  3. Attaching a single click event listener to a parent element and determining what specific action was clicked based on the event target. This would allow me to reduce the number of event listeners and improve performance.

  4. Template literals: Instead of concatenating HTML strings, you could use template literals for better readability.

  5. I could use map() and join(): When generating the elements of the list, the map() function would allow me to create an array of HTML elements and then use join('') to convert the array to a single string. This would improve performance compared to repeatedly modifying the DOM within the loop.

  6. ID Update: When an element is removed, the id attributes of other elements are updated using a loop. Instead, you could configure the id attributes of the index from scratch. This way, you wouldn't need to update them when an item is removed.

ALPANNA-GH commented 1 year ago

well done, have nothing else to say 👍