Rules for java script.

Rules for JavaScript code
using Aside format

JavaScript Standard Style

2 spaces – for indentation
Single quotes for strings – except to avoid escaping
No unused variables – this one catches tons of bugs!
No semicolons
Never start a line with (, [, or `
Space after keywords if (condition) { … }
Space after function name function name (arg) { … }
Always use === instead of == – but obj == null is allowed to check null || undefined.
Always handle the Node.js err function parameter
Always prefix browser globals with window – except document and navigator are okay
Prevents accidental use of poorly-named browser globals like open, length,
event, and name.

rules for java script