Watchtower-Course-Project

JSdocs Standards

This document is meant to provide standards of how to format JS code comments in order to have clean documentation of code.

Examples

This 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’ };