Merge pull request #1780 from alexgalkin/master
Comments section: Remove useless spaces
This commit is contained in:
commit
cf851b0087
1 changed files with 16 additions and 16 deletions
|
@ -125,25 +125,25 @@ Describe the architecture
|
||||||
Document function parameters and usage
|
Document function parameters and usage
|
||||||
: There's a special syntax [JSDoc](http://en.wikipedia.org/wiki/JSDoc) to document a function: usage, parameters, returned value.
|
: There's a special syntax [JSDoc](http://en.wikipedia.org/wiki/JSDoc) to document a function: usage, parameters, returned value.
|
||||||
|
|
||||||
For instance:
|
For instance:
|
||||||
```js
|
```js
|
||||||
/**
|
/**
|
||||||
* Returns x raised to the n-th power.
|
* Returns x raised to the n-th power.
|
||||||
*
|
*
|
||||||
* @param {number} x The number to raise.
|
* @param {number} x The number to raise.
|
||||||
* @param {number} n The power, must be a natural number.
|
* @param {number} n The power, must be a natural number.
|
||||||
* @return {number} x raised to the n-th power.
|
* @return {number} x raised to the n-th power.
|
||||||
*/
|
*/
|
||||||
function pow(x, n) {
|
function pow(x, n) {
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Such comments allow us to understand the purpose of the function and use it the right way without looking in its code.
|
Such comments allow us to understand the purpose of the function and use it the right way without looking in its code.
|
||||||
|
|
||||||
By the way, many editors like [WebStorm](https://www.jetbrains.com/webstorm/) can understand them as well and use them to provide autocomplete and some automatic code-checking.
|
By the way, many editors like [WebStorm](https://www.jetbrains.com/webstorm/) can understand them as well and use them to provide autocomplete and some automatic code-checking.
|
||||||
|
|
||||||
Also, there are tools like [JSDoc 3](https://github.com/jsdoc3/jsdoc) that can generate HTML-documentation from the comments. You can read more information about JSDoc at <http://usejsdoc.org/>.
|
Also, there are tools like [JSDoc 3](https://github.com/jsdoc3/jsdoc) that can generate HTML-documentation from the comments. You can read more information about JSDoc at <http://usejsdoc.org/>.
|
||||||
|
|
||||||
Why is the task solved this way?
|
Why is the task solved this way?
|
||||||
: What's written is important. But what's *not* written may be even more important to understand what's going on. Why is the task solved exactly this way? The code gives no answer.
|
: What's written is important. But what's *not* written may be even more important to understand what's going on. Why is the task solved exactly this way? The code gives no answer.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue