
JSDoc를 사용하면 자바스크립트 함수에 주석을 달아, 함수 호출 시 툴팁으로 노출하여 협업시 유용하게 사용할 수 있다.
/** 까지 입력하고 엔터를 치면 함수 주석이 자동완성된다.id, name을 파라미터로 받아 반환하는 getInfo 함수를 만들고 주석을 생성해보자.

@param 옆의 대괄호 사이에는 number,string 등의 파라미터 타입을, 파라미터 값 옆에는 파라미터가 무엇을 의미하는지 적는다.@returns 옆에는 함수 반환값을 적는다./**
* 아이디와 이름을 입력 받아, 합쳐서 반환하는 함수
* @param {number} id 사용자 아이디
* @param {string} name 사용자 이름
* @returns 이름과 아이디를 합쳐서 반환
*/
function getInfo(id, name) {
return name + "님의 아이디" + id;
}


/**
* 아이디와 이름을 입력 받아, 합쳐서 반환하는 함수
* @param {number} id 사용자 아이디
* @param {string} name 사용자 이름
* @returns 이름과 아이디를 합쳐서 반환
*/
function getInfo(id: number, name: string) {
return name + "님의 아이디" + id;
}


@param, @returns 외에도 다양한 annotation을 통해 문서를 설명할 수 있다.@author
// @author <name>
// @author <name> [<emailAddress>]
@version
// @version 버전정보
@copyright
// @copyright <some copyright text>
@file (@fileoverview, @overview)
// @file <some text>
@license
// @license <identifier>
@this
// @this <namePath>
@constant(@const)
// @constant [<type> <name>]
@throws (@exception)
// @throws free-form description
// @throws {<type>}
// @throws {<type>} free-form description
@requires
// @requires <someModuleName>
@todo
// @todo text describing thing to do.
@see
{@link} 와 같이 사용 가능// @see <namepath>
// @see <text>
@link ({@linkcode}, {@linkplain})
// {@link namepathOrURL}
// [link text]{@link namepathOrURL}
// {@link namepathOrURL|link text}
// {@link namepathOrURL link text (after the first space)}
@since
// @since <versionDescription>
@fires (@emits)
// @fires <className>#<eventName>
// @fires <className>#[event:]<eventName>
@event
// @event <className>#<eventName>
// @event <className>#[event:]<eventName>
@listens
// @listens <eventName>
References