I'm trying to create a Website where if you enter information it makes an object user. But I don't know how I would make different object names for each one. Is there a way you could create a variable name from a string?
function user(name,real){
this.username = name,
this.realname = real,
this.id = Math.floor(Math.random() *1000);
this.friends = 0,
this.friendnames = [],
this.listuser = function() {
return this.username;
}
};
function newuser(name, email,username){
//I want name to be what the user enters instead of name.
name = new user(username,name)
};
what should I do?