Added third way of commenting with JSDoc style (#20353)
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user