jQuery syntax guidelines

jQuery syntax guidelines

Hey everyone. I once read the jQuery core code guidelines on the docs page and while reading the jQuery 1.4 source code I could notice some additional rules that were adhered throughout the code. Like no multi-line comments, one line variable declarations, etc.

I jotted them down and also posted a blog post with examples on jQuery syntax:

- The first thing that I noticed was multiline comments did not use common /* comment */ syntax. In jQuery core all multiline comments use line comment syntax // comment.
- Local variables are declared and initialized on one line just below the function declaration with no extra line.
- When declaring objects, there is no space between property name and colon.
- All strings are in double quotes " ", not single quotes ' '.
- The last but not least, variable naming uses camelCase.

I would love to hear any other code writing rules that you could spot.