JavaScript Best Practices
Control statements
Write control statements like this:
if(iceCream) { alert('Woo hoo!'); }
Not this:
if (iceCream){ alert('Woo hoo!'); }
Also bear in mind:
- There should be no space between a control statement keyword and its opening parenthesis.
- There should be a space between the parentheses and the opening curly brace.