Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Code style conventions (much taken from http://javascript.crockford.com/code.html)

  • Do not use tab to format code. Use 4 spaces instead (configurable through a good IDE)
  • Avoid lines longer than 120 characters (again can be set through an IDE)
  • Class comments should be using /** */
  • Generally use line comments. Save block comments for formal documentation and for commenting out.
  • Give variables their own line and arrange them alphabetically (with nice line comments)
  • Define all variables at the top of the function.
  • Use camelCase for variable and function names
  • Global variables should be in all caps
  • Use of global variables should be minimized. Implied global variables should never be used.
  • Remove trailing commas if there is no other field following
  • Use {} instead of new Object(). Use [] instead of new Array().
  • It is almost always better to use the === and !== operators. The == and != operators do type coercion. In particular, do not use == to compare against falsy values.
  • Always name magic constants: http://stackoverflow.com/a/47902 if you use a number like '5' or '7' or '318' in your code, make it a constant and give it a good name at the top of the file

...