Advise against multiple assignment in var declaration
See original GitHub issueI’d suggest to include a section in the guide explaining the scoping problems of this:
function foo() {
var a = b = c = 1;
}
and to advise against it.
See http://stackoverflow.com/questions/1758576/multiple-left-hand-assignment-with-javascript
Issue Analytics
- State:
- Created 9 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Declaring multiple variables in JavaScript - Stack Overflow
The first way is easier to maintain. Each declaration is a single statement on a single line, so you can easily add, remove,...
Read more >Multiple var statements in JavaScript, not superfluous
Assignments must be in their own var statement. Like this: // SIMPLE AND SEXY var foo, bar, baz; var abc = 1; var...
Read more >DCL04-C. Do not declare more than one variable per ...
Declaring multiple variables in a single declaration makes sense if the rest of the code requires all these variables to have identical type....
Read more >t sql - Assigning values to multiple @variables using SELECT
If there are multiple assignment clauses in a single SELECT statement, SQL Server does not guarantee the order of evaluation of the expressions....
Read more >Multiple variables should not be declared on the same line
Declaring multiple variables on one line is difficult to read. Noncompliant Code Example. class MyClass { private int a, b; public void method(){...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ljharb Ah, my bad. I didn’t notice that the rule works for this particular situation too. PR incoming ASAP!
@awesomeaniruddh I believe http://eslint.org/docs/rules/one-var with the option “never” is the one I’m thinking of - we enable that here