js variable is used before being assigned code example
Example: Variable is used before being assigned
EXPLANATION IN MICROSOFT DOCS:
1)Check your control flow logic and make sure the variable has a valid value
before controlpasses to any statement that reads it.
2)One way to guarantee that the variable always has a valid value is to
initialize it as part of its declaration.