From Seo Wiki - Search Engine Optimization and Programming Languages

Jump to: navigation, search

JSDoc is a syntax for adding inline API documentation to JavaScript source code. This is distinct from the various tools that parse and manipulate code that follows the JSDoc syntax.

The JSDoc syntax is similar to the Javadoc syntax, used for documenting Java code, but is specialized to work with JavaScript's more dynamic syntax and therefore unique, as it is not completely compatible with Javadoc. However, like Javadoc, JSDoc allows the programmer to create doclets and tags which can then be translated into published output, like HTML or RTF.


JSDoc tags

Tag Description
@author Developer's name
@constructor Marks a function as a constructor
@deprecated Marks a method as deprecated
@exception Synonym for @throws
@param Documents a method parameter; a datatype indicator can be added between curly braces
@private Signifies that a method is private
@return Documents a return value
@see Documents an association to another object
@throws Documents an exception thrown by a method
@version Provides the version number of a library


An example of JSDoc usage.

  * Creates an instance of Circle
  * @constructor
  * @param {number} r The desired radius of the circle
  function Circle(r) {
    this.radius = r;
  * Returns circumference of circle
  * @returns {number} The circumference of the circle
  function circumference () {
    return 2 * Math.PI * this.radius;


The earliest example of using a Javadoc-like syntax to document JavaScript was released in 1999 with the Netscape/Mozilla project named Rhino.

JSDoc In Use

  • The JSDoc syntax has been described at length in the Apress book Foundations of Ajax ISBN 1-59059-582-3.
  • IntelliJ and RubyMine understand JSDoc syntax.
  • The Eclipse IDE has extensions that understand the JSDoc syntax. Eclipse-based Aptana Studio supports ScriptDoc, and the included JavaScript files are commented in ScriptDoc.
  • Mozile, the Mozilla Inline Editor uses JSDoc.
  • The Helma application framework uses JSDoc.

See also

External links

Documentation generators


Personal tools

Served in 0.064 secs.