You define a class template (to use Java lingo) with a function definition and then create an instance of the object with the new statement: |
function MenuObject(no, name) { |
this.no = no; // Give instance a numerical label |
this.name = name; // Label this particular menu |
this.color = 'black'; |
this.menuSelection = 1; |
this.count = 0; |
this.options = new Array(); // To be discussed |
} |
Define two menu instances: |
worldMenu = new MenuObject(1, 'world'); |
familyMenu = new MenuObject(2, 'family'); |