JavaScript: Class Constructor

The fundamental part of most classes is its constructor, which sets up each instance’s initial state and handles any parameters that were passed when calling new. It’s defined in a class block as though you’re defining a method named constructor, though it’s actually handled as a special case. Example usage: A small thing to note … 

 

JavaScript Best Practices: Functions

Function expressions: Function declarations: Never declare a function in a non-function block (if, while, etc). Assign the function to a variable instead. Browsers will allow you to do it, but they all interpret it differently, which is bad news bears. Note: ECMA-262 defines a block as a list of statements. A function declaration is not … 

 

Node Best Practices

Node Style Guide Style Example Testing Version Switching Style Use four spaces for indenting your code (do not use tabs) Use \n for a newline character (yes this is unix specifc, do not use the Window format \r\n) No trailing white space (you should be able to configure your editor to do this automatically) Use …