1 | 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: |
2 | function MenuObject(no, name) { |
3 | this.no = no; // Give instance a numerical label |
4 | this.name = name; // Label this particular menu |
5 | this.color = 'black'; |
6 | this.menuSelection = 1; |
7 | this.count = 0; |
8 | this.options = new Array(); // To be discussed |
9 | } |
10 | Define two menu instances: |
11 | worldMenu = new MenuObject(1, 'world'); |
12 | familyMenu = new MenuObject(2, 'family'); |