When calling a function, there is no space between the function name and the left bracket.
There is no space between the function name and the parameter sequence; there is one space between all other syntax elements and the left parenthesis.
Use camelCase naming convention for all variables and properties.
Use two spaces for indentation and single quotes uniformly.
Associative arrays, unless there are spaces or illegal characters in the key name, do not use quotation marks.
Do not combine statements with different purposes into one line.
Don’t omit the semicolon at the end of a sentence, even if there is only one sentence on a line.
Do not use the increment ( ) and decrement (--) operators, use = and -= instead.
Do not use the "equality" (==) operator, only use the "strict equality" (===) operator.
All variable declarations are placed at the head of the function.
All functions are defined before use.
Try to name the constructor and callback functions so that you can see the call stack more clearly when debugging.
Try to define all member functions through prototypes, define properties in the constructor, and then use the new keyword in the constructor to create objects.
Avoid complex inheritance. If you want to inherit, try to use the inherits function in the util module. For example, if A inherits B, you can use util.inherits(A,B).
Reference:
Appendix B (BYVoid) of "Node.js Development Guide"
Javascript programming style (Ruan Yifeng)