You define the Class template (to use a Java lingo) with a function definition |
Then create an instance of the object with the new statement which acts as a constructor to initialize values |
function MakeMenu(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(); // We will discuss this later |
} |
worldmenu = new MakeMenu(1,'world'); |
familymenu = new MakeMenu(2,'family'); // define two menu instances |