Skip to content

The JavaScript best practices. #7

@Chandan-devs-tech

Description

@Chandan-devs-tech

export let arrayOfTasks = JSON.parse(localStorage.getItem('arrayOfTasks')) || [];

  • It is Javascript's best practice to use the const keyword for declaring an array.

if (taskInput.value !== '') {

  • Try not to use negative condition in the conditional statement and also instead of writing !==' ' inside the if block condition taskInput.value

localStorage.setItem('arrayOfTasks', JSON.stringify(arrayOfTasks));

  • In lines 29, 41, 52 instead of writing Local storage again and again try to use the function and call that function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions