mul14
7/25/2018 - 2:29 PM

JavaScript DocBlock Cheat Sheet

JavaScript DocBlock Cheat Sheet

/**
 * Description of this function.
 * 
 * @param {string}      name 
 * @param {Date}        birthday 
 * @param {boolean=}    isMarried       Optional parameter.
 * @param {string|null} [bloodType]
 * @param {number=}     [weight=0]      Optional parameter with default value.
 * @param {string[]}    favoriteFoods   Array of String.
 * 
 * @returns {Object}
 */
function Person(name, birthday, isMarried, bloodType = null, weight = 0, favoriteFoods = []) {
  return {
    name,
    birthday,
    weight,
    bloodType,
    isMarried,
    favoriteFoods,
  }
}