Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow JavaScript best practices #4

Closed
RWUBAKWANAYO opened this issue May 3, 2022 · 0 comments
Closed

Follow JavaScript best practices #4

RWUBAKWANAYO opened this issue May 3, 2022 · 0 comments

Comments

@RWUBAKWANAYO
Copy link
Owner

RWUBAKWANAYO commented May 3, 2022

Hi @RWUBAKWANAYO ,
Great job on completing your Todo-List project! Outstanding work! 👏🏼🔥

Highlights 🥳

  • Great design ✔️
  • No linter errors ✔️
  • Great job writing clean code. 🔥

Recommended Changes ♻️

  • Kindly avoid creating new functions to filter and map through array on deleteTodos function which exists in ModifyTodos.js file
    const newTodos = todos.filter((item) => +item.index !== +targetIndex)
    .map((item, index) => {
    item.index = index + 1;
    return item;
    });
  • In newTodos of the deleteTodos function, instead of set whole objects value of the todos array you can only change the index of each object
    const newTodos = filterTodo.map((item, index) => ({
    description: item.description,
    completed: item.completed,
    index,
    }));

Cheers and happy coding! 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant