From 8f96524c363d6cfbfac6862589e34be05632f300 Mon Sep 17 00:00:00 2001 From: Vishesh Date: Mon, 29 Oct 2018 11:30:37 -0400 Subject: [PATCH] Added third way of commenting with JSDoc style (#20353) --- guide/english/javascript/comments/index.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/guide/english/javascript/comments/index.md b/guide/english/javascript/comments/index.md index 5c88abd0f3..105f30beae 100644 --- a/guide/english/javascript/comments/index.md +++ b/guide/english/javascript/comments/index.md @@ -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