statisk variabel
Kan jeg lave en statisk variabel i javascript ?Jeg skal brug den i en metode på en "klasse" til at give hvert objekt et unkit id:
function addLeaf(...)
{
this.items[this.count] = new leafType();
this.items[this.count].parent = this;
this.items[this.count].title = title;
this.items[this.count].onClickEvent = onClick;
this.items[this.count].id = ''; // <-- unikt id
this.items[this.count++].contextMenu = contextMenu;
return this.items[this.count-1];
}
