Skip to content
nene edited this page Mar 21, 2012 · 8 revisions

Synopsis:

@return
Some description...

@return {Type}
Some description...

@return {Type} return.subproperty
Some description...

Documents the return value of a method. You can either use @return or @returns.

For constructors the return type defaults to Object, otherwise it defaults to undefined which means the return value is not shown in documentation.

Returning object

To document properties of the object that is returned, use the following syntax:

/**
 * @return {Object} A user record
 * @return {String} return.name The name of the user.
 * @return {String} return.email The email of the user.
 */
function getUser() {
}

Returning function

When returning a function, its parameters and return value can also be documented:

/**
 * @return {Function} A predicate function that
 * determines is number is odd or even.
 * @return {Number} return.value The number to test.
 * @return {Boolean} return.return True if number is even.
 */
function createEvenPredicate() {
}

See also documentation for @param.

Clone this wiki locally