Comments

JSDoc

Use JSDoc for defining methods/functions.

/**
 * Description of the function.
 *
 * @param {array}   colors       - Array of colors.
 * @param {boolean} hasPotOfGold - Default: true.
 * @param {object}  data         - API response.
 * @param {string}  insertType   - [append|replace] Method to update the markup.
 */
function rainbow (colors, hasPotOfGold, data, insertType) {
    // Something
}
  • Write function description as a sentence.
  • Write param descriptions as sentences.
  • Use [a|b|c] to define expected values.