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

Exercise - Best Practice Rules #5

Open
gak92 opened this issue Jul 11, 2022 · 0 comments
Open

Exercise - Best Practice Rules #5

gak92 opened this issue Jul 11, 2022 · 0 comments

Comments

@gak92
Copy link
Owner

gak92 commented Jul 11, 2022

  1. JavaScript Best Practices:
  • No general issue was found
  • use of const and let for variable declaration
  • use of arrow functions
  1. DRY, KISS, and YAGNI Rules:
  • There is some code repetition, which can be improved by using function or ternary operator:

    if (LocalStorage.getData() === null) {
      tasksList = [];
    } else {
      tasksList = LocalStorage.getData();
    }
    
  • It would be better to keep the code organized by keeping addTask in the UI.js as other functions:
    const addTask = (newTask) => {

  • It would be better to use forEach instead of simple for loop:

    for (let i = 0; i < tasksList.length; i += 1) {
      tasksList[i].index = i + 1;
      }
      return tasksList;
    
  1. HTML and CSS best practices:
  • No issue found in HTML and CSS code for best practices
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