What does param mean

param tag calls for you to specify the name of the parameter you are documenting. You can likewise encompass the parameter's type, enclosed in curly brackets, and also a summary of the parameter.

You watching: What does param mean

The parameter form deserve to be a built-in JavaScript form, such as string or Object, or a rcfereform.org nameroute to one more symbol in your code. If you have created documentation for the symbol at that namepath, rcfereform.org will certainly instantly connect to the documentation for that symbol. You can additionally use a form expression to indicate, for instance, that a parameter is not nullable or have the right to accept any kind of type; view the
kind tag documentation for details.

If you administer a summary, you have the right to make the rcfereform.org comment even more readable by inserting a hyphen prior to the description. Be certain to encompass a room prior to and also after the hyphen.

Examples

Names, types, and also descriptions

The following examples show exactly how to include names, forms, and descriptions in a
param string somebody */attribute sayHello(somebody) alert("Hello " + somebody); Name, form, and description /** *
param string somebody Somebody"s name. */feature sayHello(somebody) alert("Hello " + somebody); You have the right to add a hyphen before the description to make it even more readable. Be sure to include an area prior to and also after the hyphen.

See more: Nonprofit Legal Services Of Utah, Inc, Nonprofit Legal Services Of Utah, Inc

Name, form, and summary, via a hyphen before the summary

/** *
param string somebody - Somebody"s name. */feature sayHello(somebody) alert("Hello " + somebody);

Parameters via properties

If a parameter is supposed to have a certain residential or commercial property, you have the right to record that residential property by offering an additional
param tag. For instance, if an employee parameter is meant to have name and department properties, you have the right to document it as follows:

Documenting a parameter's properties

/** * Asauthorize the project to an employee. *
param string employee.department - The employee"s department. */Project.protokind.asauthorize = function(employee) // ...; If a parameter is destructured without an explicit name, you deserve to give the object an proper one and record its properties.

Documenting a destructuring parameter

/** * Assign the job to an employee. *
param string employee.department - The employee"s department. */Project.protokind.asauthorize = function( name, department ) // ...; You can likewise combine this syntaxation via rcfereform.org's syntax for range parameters. For instance, if multiple employees can be assigned to a project:

Documenting properties of values in an selection

/** * Assign the task to a list of employees. *
param string employees<>.department - The employee"s department. */Project.protoform.asauthorize = function(employees) // ...;

Optional parameters and also default values

The complying with examples present exactly how to indicate that a parameter is optional and has a default value.

An optional parameter (utilizing rcfereform.org syntax)

/** *
param string - Somebody"s name. */function sayHello(somebody) if (!somebody) somebody = "John Doe"; alert("Hello " + somebody); An optional parameter (using Google Clocertain Compiler syntax) /** *
param string= somebody - Somebody"s name. */feature sayHello(somebody) if (!somebody) somebody = "John Doe"; alert("Hello " + somebody); An optional parameter and default value /** *
param string - Somebody"s name. */feature sayHello(somebody) if (!somebody) somebody = "John Doe"; alert("Hello " + somebody);

Multiple kinds and also repeatable parameters

The adhering to examples show how to usage form expressions to show that a parameter deserve to accept multiple forms (or any type of type), and that a parameter can be offered more than as soon as. See the
kind tag documentation for details about the type expressions that rcfereform.org supports.

Allows one type OR an additional kind (form union)

/** *
param (string - Somebody"s name, or an selection of names. */function sayHello(somebody) if (!somebody) somebody = "John Doe"; else if (Array.isArray(somebody)) somebody = somebody.join(", "); alert("Hello " + somebody); Allows any kind of kind /** *
param * somebody - Whatever you desire. */attribute sayHello(somebody) console.log("Hello " + JSON.stringify(somebody)); Allows a parameter to be repetitive /** * Retransforms the sum of all numbers passed to the function. *
param ...number num - A positive or negative number. */attribute sum(num) { var i = 0, n = disagreements.size, t = 0; for (; i

Callback functions

If a parameter accepts a callearlier feature, you can use the
param tag.

Parameters that accept a callback /** * This callearlier kind is referred to as `requestCallback` and is displayed as an international symbol. * *
param string responseBlog post *//** * Does something asynchronously and executes the callearlier on completion. *
param requestCallback cb - The callback that handles the response. */function doSomethingAsynchronously(cb) // code;

Related Links

*