Code Monkey home page Code Monkey logo

to-do-list's Introduction

Hello there, I'm Joaquín! hi

💼 Currently working at Tranzact.

⚙️ Working on some small side-projects on my free time

🤔 New ideas for projects are always welcome!

💬 Let's chat about anything!

📫 Write me an e-mail!

Mail Badge

💻 My tech-stack:

Visual Studio Code

Git

GitHub

Terminal

Heroku

Netlify

Eslint

Stylelint

Lighthouse

Webhint-icon

Rubocop

HTML5

CSS3

JavaScript

Webpack

Jest

React

React-router

Redux

Postgresql

Ruby

Rails

Sendgrid

Bootstrap

Tailwind




😎 My GitHub stats:






🛰 Contact me on social media!

Linkedin Badge Twitter Badge Mail Badge

to-do-list's People

Contributors

kakalanp avatar micky373 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

to-do-list's Issues

Do I follow JavaScript best practices? -- Self code review.

DRY rule:

  • In these parts, I declared the dynamic event listeners separately each time createList is executed:

    TO-DO-list/src/index.js

    Lines 46 to 48 in e84dbd5

    createList();
    addTask.value = '';
    deleteSingleTask();

    TO-DO-list/src/index.js

    Lines 60 to 63 in e84dbd5

    document.addEventListener('DOMContentLoaded', () => {
    createList();
    deleteSingleTask();
    });

    TO-DO-list/src/index.js

    Lines 34 to 38 in e84dbd5

    deleteList = [];
    createList();
    deleteSingleTask();
    }
    Although this is not very notorious, it may lead to some loops and exponentially growing code whenever the first function is called, a great solution to the problem would be fixing the next method:

    TO-DO-list/src/index.js

    Lines 9 to 21 in e84dbd5

    function deleteSingleTask() {
    const deleteBtns = document.getElementsByClassName('delete-button');
    const deleteBtnsArr = Array.from(deleteBtns);
    deleteBtnsArr.forEach((el, i) => {
    el.addEventListener('click', () => {
    const deleteList = [];
    deleteList.push(i);
    deleteTask(deleteList);
    el.parentElement.parentElement.remove();
    });
    });
    }
    A great solution to the issue would be to, first, move the event listeners to the end of the createList declaration

    TO-DO-list/src/index.js

    Lines 10 to 14 in e84dbd5

    const deleteBtns = document.getElementsByClassName('delete-button');
    const deleteBtnsArr = Array.from(deleteBtns);
    deleteBtnsArr.forEach((el, i) => {
    el.addEventListener('click', () => {
    followed by the second step, importing the algorithms from another file, and calling them as a function inside the event listeners moved beforehand

    TO-DO-list/src/index.js

    Lines 15 to 18 in e84dbd5

    const deleteList = [];
    deleteList.push(i);
    deleteTask(deleteList);
    el.parentElement.parentElement.remove();
    This way, everything is more organized and functional, preventing bugs and reducing the propensity to elongate the code meaninglessly.

HTML best practices:

  • You can always add your h1 tag inside a header tag whenever you don't have a navbar:
    <h1 class="title">Today's To Do</h1>
    <input type="text" id="addText" placeholder="Add to your list...">

Peer to Peer code Review

What we can change

  • More comments to provide more clarity on functions
  • Separate DOM content with functions

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.