-
Notifications
You must be signed in to change notification settings - Fork 1
JS: Should describe 3 types of comment delimiters, not 2. #42
Copy link
Copy link
Open
Labels
Description
I think we should call out 3 types of comments:
- doc comments - Comments placed immediately before function and class declarations that are meant to be parsed by a doc generation tool
- multi-line comments - Meant to be read inline in the code only, not output via auto doc generation
- single-line comments
This is consistent with how many editors and IDEs classify comments and more closely matches how developers should think about comments (IMHO).
Doc comment example:
/**
* Calculates an estimated shipping cost for a set of products. If the value
* of "products" is null or an empty array, -1 is returned.
*
* @param products
* An array of ProductInfo objects.
* @return
* A number expressed in US dollars
*/
function estimateShipping(products) {
…
}
Multi-line comment example:
/*
This is a multi-line comment and is being used
because we're describing something a bit complex.
*/
Single-line comment example:
// Single-line comment for short notes.
Reactions are currently unavailable