idea

Best Practices

Comment this:

  • Overall architecture, high-level view.
  • Function usage.
  • Important solutions, especially when not immediately obvious.

Avoid comments:

  • That tell “how code works” and “what it does”.
  • Put them in only if it’s impossible to make the code so simple and self-descriptive that it doesn’t require them.

Comments are also used for auto-documenting tools like JSDoc3: they read them and generate HTML-docs (or docs in another format).