JSDoc자바스크립트 소스 코드 파일들에 주해를 달기 위해 사용하는 마크업 언어이다. JSDoc을 포함하는 주석을 사용하는 프로그래머들은 자신들이 작성하는 코드의 API를 설명하는 설명 문서를 추가할 수 있다. 그 뒤 다양한 도구들에 의해 처리되어 HTML리치 텍스트 포맷 등의 접근 가능한 포맷으로 문서가 생성된다. JSDoc 사양은 CC BY-SA-3.0으로 배포되며, 이와 동반되는 문서 생성기와 파서 라이브러리는 아파치 라이선스 2.0으로 배포되는 자유 소프트웨어이다.

JSDoc
발표일1999년(25년 전)(1999)
최신 버전
3.6.3
(2019년 7월 15일(4년 전)(2019-07-15))
포맷 종류프로그래밍 문서화 포맷
다음에 포함자바스크립트 소스 파일
다음으로부터 확장JavaDoc
웹사이트jsdoc.app

예시 편집

/** @class Circle representing a circle. */
class Circle {
  /**
   * Creates an instance of Circle.
   *
   * @author: moi
   * @param {number} r The desired radius of the circle.
   */
  constructor(r) {
    /** @private */ this.radius = r
    /** @private */ this.circumference = 2 * Math.PI * r
  }

  /**
   * Creates a new Circle from a diameter.
   *
   * @param {number} d The desired diameter of the circle.
   * @return {Circle} The new Circle object.
   */
  static fromDiameter(d) {
    return new Circle(d / 2)
  }

  /**
   * Calculates the circumference of the Circle.
   *
   * @deprecated since 1.1.0; use getCircumference instead
   * @return {number} The circumference of the circle.
   */
  calculateCircumference() {
    return 2 * Math.PI * this.radius
  }

  /**
   * Returns the pre-computed circumference of the Circle.
   *
   * @return {number} The circumference of the circle.
   * @since 1.1.0
   */
  getCircumference() {
    return this.circumference
  }

  /**
   * Find a String representation of the Circle.
   *
   * @override
   * @return {string} Human-readable representation of this Circle.
   */
  toString() {
    return `[A Circle object with radius of ${this.radius}.]`
  }
}

/**
 * Prints a circle.
 *
 * @param {Circle} circle
 */
function printCircle(circle) {
    /** @this {Circle} */
    function bound() { console.log(this) }
    bound.apply(circle)
}

같이 보기 편집

외부 링크 편집