Added third way of commenting with JSDoc style (#20353)

This commit is contained in:
Vishesh
2018-10-29 11:30:37 -04:00
committed by Tom
parent c54896273b
commit 8f96524c36

View File

@ -38,6 +38,20 @@ function hello() {
}
hello();
```
The third way is the `/** */` comment, a format popularly known as JSDoc, can be used to clearly describe functions, classes, methods, and variables in your codebase in a detailed way. For example:
```javascript
/**
* Adds two numbers together
*
* @param {number} num1 - first parameter
* @param {number} num2 - second parameter
* @returns {number}
*/
function addTwoNumbers(num1, num2) {
return num1 + num2;
}
console.log(addTwoNumbers(10,20)) // will print 30 in the console.
You can also prevent execution of Javascript code just commenting the code lines like this:
```javascript