edahigure / to-do-list

This is an activities organizer. Or a to-do-list app. You can add, check , and delete activities from the local storage
0 stars 0 forks source link

Refactor tasklist.js #5

Open edahigure opened 1 year ago

edahigure commented 1 year ago

lines 226-232

Maybe this can be refactored

let retDataTemp = [];

if (localStorage.taksListStorage !== undefined) { retDataTemp = JSON.parse(localStorage.taksListStorage); }

export const myTask = new ListTasks(retDataTemp);

to be simpler or put it on the constructor

edahigure commented 1 year ago

lines 92-94 may also be refactored to don's use for
for (let i = 0; i < result.length; i += 1) { result[i].index = i; }

edahigure commented 1 year ago

lines 166 - 167 may be refactored for (let i = 0; i < this.taskListArr.length; i += 1) { this.initEvent(i); }

edahigure commented 1 year ago

lines 176-178

This may also be refactored

    for (let i = 0; i < this.taskListArr.length; i += 1) {
      if (this.taskListArr[i].completed === false) {
        newArray.push(this.taskListArr[i]);
      }
    }
edahigure commented 1 year ago

lines 220 226 code is repeated almost identically.