static methods & fields (JS)
Në shqip: Anëtarët statikë në JS
ShpjegimiSQ
Një metodë static i përket klasës, jo objekteve — e thërret si Math.max() ose Nxenes.krijo(). Përdoret për funksione ndihmëse dhe „fabrika“.
EnglishEN
A static method belongs to the class, not its objects — you call it like Math.max() or Student.create(). Used for helper functions and “factories”.
Si ta mendosh
Si sekretaria e shkollës: një për gjithë shkollën, jo për çdo nxënës.
Lexoje në anglisht
Like the school secretary: one for the whole school, not one per student.
Shembull kodijavascript
class Nxenes {
static numri = 0;
static krijo(emri) { Nxenes.numri++; return new Nxenes(emri); }
}