Is there a rule for preferring if / else to initialising a variable and then overriding it? #14250
Answered
by
nzakas
guilhermesimoes
asked this question in
Q&A
-
Basically, prefer this: let unitialisedVariable;
if (someCondition) {
unitialisedVariable = someValue;
} else {
unitialisedVariable = someOtherValue;
} over this: let unitialisedVariable = someOtherValue;
if (someCondition) {
unitialisedVariable = someValue;
} Is there a rule for this situation? |
Beta Was this translation helpful? Give feedback.
Answered by
nzakas
Apr 6, 2021
Replies: 1 comment 1 reply
-
No there isn’t. You can see all core rules here https://eslint.org/docs/rules/ |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
guilhermesimoes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No there isn’t. You can see all core rules here https://eslint.org/docs/rules/