I have a problem I need to solve regarding my Javascript code. When instantiating object (in this case adding new members) I want the members to get unique ids. Below is a simplified version of my code to give you a picture of what I want. What is the best way to do this?
function Member(name){
//unique id code...
this.getName = function(){
return name;
}
this.setName = function(_name){
name = _name;
}
}
I guess its easy as:
yournamespace should be your application object or whatever. You also could replace it with
windowin a browser, to have theMemberconstructor global.