Skip to content

Stop mutating and having global variables. #76

@otajor

Description

@otajor

You have this function.

function getUserInput(event){
  userInput = event.target.value;
  return userInput;
}

Why are you mutating a global variable and then returning it? Why not just return the event as is. As far as I can see, you never actually use the global variable, at least not in this file. In any case, you should be able to get the user input at any time from the DOM, so having this kind of function is unnecessary. Avoid accessing or mutating (or even creating, ideally) global variables like this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions