File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -247,15 +247,25 @@ The following sections outline a _reasonable_ style guide for modern JavaScript
247
247
248
248
249
249
// 2.B.1.2
250
- // Using only one ` var ` per scope (function) promotes readability
251
- // and keeps your declaration list free of clutter (also saves a few keystrokes)
250
+ // Using only one ` var ` per scope (function) or one ` var ` for each variable,
251
+ // promotes readability and keeps your declaration list free of clutter.
252
+ // Using one ` var ` per variable you can take more control of your versions
253
+ // and makes it easier to reorder the lines.
254
+ // One ` var ` per scope makes it easier to detect undeclared variables
255
+ // that may become implied globals.
256
+ // Choose better for your project and never mix them.
252
257
253
258
// Bad
259
+ var foo = "",
260
+ bar = "";
261
+ var qux;
262
+
263
+ // Good
254
264
var foo = "";
255
265
var bar = "";
256
266
var qux;
257
267
258
- // Good
268
+ // or..
259
269
var foo = "",
260
270
bar = "",
261
271
qux;
You can’t perform that action at this time.
0 commit comments