JSDoc ni igikoresho gikomeye co gukora inyandiko za JavaScript. Ikoresha ibivugwa mu buryo budasanzwe kugira ngo ikore inyandiko za API zitomoye kuri kode yawe. Mu kwongerako ibitekerezo vya JSDoc ku madosiye yawe ya JavaScript, urashobora gutanga amakuru atomoye kandi atunganijwe yerekeye ibikorwa vyawe, amashure, n'ibice.
Ibirango vy'ingenzi vya JSDoc:
Andika amakuru
Imirongo y'imikorere n'agaciro k'igaruka
Insobanuro z'ishure n'uburyo
Inyandiko z'ibice
Imwe mu nzira ngirakamaro cane muri JSDoc ni @example tag. Iyi tag iragufasha gushiramwo ingero za kode mu nyandiko zawe. Igitandukanya igikoresho cacu ni ubushobozi bwaco bwo kuzigama uburyo bwo guhindura, gushiramwo, n'imirongo y'imirongo mu @example tag. Ivyo bisigura ko ushobora kwandika ingero za kode zisomwa kandi ziboneka, bikaba vyoroshe ku bategura gutahura ingene bakoresha ibikorwa vyawe canke amashure yawe.
Akarorero k'ikoreshwa:
/**
* Calculates the sum of two numbers.
* @param {number} a - The first number.
* @param {number} b - The second number.
* @returns {number} The sum of a and b.
* @example
* // This example preserves formatting and line breaks
* const result = add(5, 3);
* console.log(result);
* // Output: 8
*/
function add(a, b) {
return a + b;
}
Ukoresheje umuhinguzi wacu wo kuri interineti wa JSDoc, urashobora gukora mu buryo bworoshe inyandiko zitunganijwe neza zirimwo uburyo buzigamye mu ngero zawe za kode, bigatuma inyandiko zawe za JavaScript zitomoka kandi zikora neza.