Search code examples
javascriptdocumentationdocumentation-generation

What is the standard way of adding documentation to a JavaScript function?


I'm looking at generating API docs for a JavaScript project. Does JavaScript have anything similar to Python's docstring?

function add(a, b) {
  /**
    Returns the sum of `a` and `b`.
  */
  return (a - 0) + (b - 0);
}

Solution

  • Have you seen JSDoc (which has now been superceded by JSDoc toolkit)?