You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Try to avoid short-hand operators except in very simple scenarios.
288
289
*Right:*
289
290
@@ -302,7 +303,8 @@ var big = (x > 10) ? checkX(x)?getExtraLarge():getDefaultSize():getSmallValue();
302
303
~~~
303
304
304
305
305
-
##Curly braces
306
+
## Curly braces
307
+
306
308
Always use curly braces even in the cases of one line conditional operations.
307
309
308
310
*Right:*
@@ -324,7 +326,8 @@ if (a)
324
326
if (a) return 'winning';
325
327
~~~
326
328
327
-
##Boolean comparisons
329
+
## Boolean comparisons
330
+
328
331
**Do not** directly compare with true, or false.
329
332
330
333
*Right:*
@@ -548,7 +551,8 @@ function doAsync(arg, onSuccess, onError) {
548
551
}
549
552
~~~
550
553
551
-
##Comments
554
+
## Comments
555
+
552
556
Use the [JSDoc][JSDOC] convention for comments. When writing a comment always think how understandable will be for somebody who is new to this code. Even if it may look simple to you think how a guy that just joined will understand it. Always comment in the following cases:
553
557
+ When there is some non-trivial logic.
554
558
+ Some 'external' knowledge is needed which is missing in the context - workaround for driver, module bug, special 'hack' because of a bug and so on;
@@ -559,7 +563,8 @@ Use the [JSDoc][JSDOC] convention for comments. When writing a comment always th
559
563
[param]: http://usejsdoc.org/tags-param.html
560
564
561
565
562
-
##Commenting of parameters that are objects/complex types
566
+
## Commenting of parameters that are objects/complex types
567
+
563
568
When you have parameters that are complex objexts like *options* or other type for which the properties are not clear or is external one use the [@type-def tag][typedef]
564
569
565
570
*Right:*
@@ -598,7 +603,8 @@ function checkProperties(properties) {
598
603
599
604
[typedef]: http://usejsdoc.org/tags-typedef.html
600
605
601
-
##File/module structure
606
+
## File/module structure
607
+
602
608
Typical module should have the following structure:
0 commit comments