DEV Community

Discussion on: Commenting: where?

Collapse
 
lionelrowe profile image
lionel-rowe

Either to the right (if comment and code are both very short) or above. Never after — that's just confusing and inconsistent with how standards such as JSDoc, JavaDoc, PHPDoc etc. work. For example:

/**
 * Capitalizes the first letter of a string
 * @param {string} str
 * @returns {string}
 */
const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1)
Enter fullscreen mode Exit fullscreen mode
Collapse
 
vulcanwm profile image
Medea

ah okay!