Always ensure JSDoc comments accurately reflect the actual code implementation. Parameter types, optionality, and function behavior must be precisely documented to prevent confusion and bugs.
Always ensure JSDoc comments accurately reflect the actual code implementation. Parameter types, optionality, and function behavior must be precisely documented to prevent confusion and bugs.
When documenting parameters:
For example, if a function accepts multiple types or optional parameters:
/**
* Process user input
*
* @param {String|Array} input - The input to process
* @param {Object} [options] - Optional configuration object
* @return {Boolean} Whether processing succeeded
*/
function process(input, options) {
// implementation
}
Incorrect or outdated JSDoc can mislead developers and lead to runtime errors. Always review JSDoc comments when changing function signatures or behavior to ensure documentation and implementation remain synchronized.
Enter the URL of a public GitHub repository