JSDoc defarkatu këyitu JavaScript la bu am doole. Dafay jëfandikoo komànteer yuñ formaate ngir sosal këyitu API yu leer ngir sa kode. Soo yokkee ay komànteer JSDoc ci say fichier JavaScript, di nga mëna joxe leeral yu leer te jaar yoon ci say fonction, say klaas ak say modle.
Man-mani JSDoc yi gëna am solo:
Bindal leeral
Parametru fonction yi ak valeur yi ñuy delloo
Tegtal klaas ak njuréef
Këyitu modle
Benn tag bu am njariñ ci JSDoc mooy tag @example. Etiket bii daf lay may nga boole misaali kod ci say këyit. Li wuutale sunu jumtukaay mooy mën na tëye formaateer yi, lëndëm yi ak dagg liiñ yi ci biir etiketu @example. Loolu dafay tekki ni mën nga bind misaali kod yu yomb lire te gëna dëggu, suko defee developpeur yi gëna yombal ni ñuy jëfandikoo say fonction wala say class.
misaalu jëfandikoo gi:
/**
* 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;
}
Soo jëfandikoo sunu generatëru komànteer JSDoc ci net bi, di nga mëna sos ci anam wu yomb dokimaa yu formate bu baax, yu am formate buñ denc ci say misaali kod, gëna leerloo sa dokimaa JavaScript ak njariñ.