Skip to content

Commit d6ba60a

Browse files
committed
Merge pull request #187 from henricavalcante/master
Change declarations of variables 2.B.1.2
2 parents 1bd1469 + d75eb00 commit d6ba60a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

readme.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,25 @@ The following sections outline a _reasonable_ style guide for modern JavaScript
247247
248248
249249
// 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.
252257
253258
// Bad
259+
var foo = "",
260+
bar = "";
261+
var qux;
262+
263+
// Good
254264
var foo = "";
255265
var bar = "";
256266
var qux;
257267
258-
// Good
268+
// or..
259269
var foo = "",
260270
bar = "",
261271
qux;

0 commit comments

Comments
 (0)