This document is meant to provide standards of how to format JS code comments in order to have clean documentation of code.
/** and end with */@param{type} tag and then provide a short description of what the parameter is@returns{type} tag and then provide a short description of what the function returns is@deprecated tag if a function becomes obsolete and add details of what function to replace its usage@typedef{Object} write the name of the object@property{type}, including the name of the property along with a short description of what the property isThis is an example of what a completed comment for a function should look like for JSdocs to work
/** Adds 2 numbers together @param{number} 1st value to be added @param{number} 2nd value to be added @returns{number} the sum of the values added together @example let a = 10 let b = 20 const value = addNum(a,b); console.log(result); // Logs: 30 */ function addNum(Num1,Num2){ return Num1+Num2; }
This is an example of what a deprecated function looks like
/** @deprecated */ function addNum(Num1,Num2){ return Num1+Num2; }
This is what a custom object would look like
/** @typedef {Object} Dog @property {string} breed, name of breed @property {string} gender, gender of dog const dog= { breed:’Pitbull’ gender:’Male’ };