Can I do something like?:
function User(form) {
this._username = form.username.value;
this._password = form.password.value;
this._surname = form.surn
You can't do that, since JavaScript is not a strongly typed language it will not see a difference between form and userName. You can create multiple function like createUserFromForm(form)
and createUserFromUserInfo(userName, password,...)
or you could try to use a singular constructor with no arguments specified and then use arguments collection to check the input and decide what to do.