When calling a function, there is no space between the function name and the opening bracket.
There is no space between the function name and the sequence of parameters; there is a space between all other syntax elements and the opening bracket.
Use the small camel nomenclature as the naming rule for all variables and attributes.
Use two spaces to indent and single quotes are used uniformly.
Associative arrays are not quotation marks unless there are spaces or illegal characters in the key name.
Do not merge 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 in one line.
Do not use the autoincrement (++) and autoincrement (--) operators, use += and -= instead.
Do not use the "equal" (==) operator, just 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 function, so that you can see a clearer call stack when debugging.
Try to define all member functions through prototypes, define attributes within the constructor, and then use the new keyword to create an object for the constructor.
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 util.inherits(A,B).
References:
Appendix B (BYVoid)
Javascript programming style (Ruan Yifeng)