How do I construct a new instance of a defined object?
I have code similar to this but the this.User = new User();
it doesn't work.
(function () {
SomeApp = {
User: {
FirstName: '',
LastName: ''
},
Users: [],
init: function () {
this.User.FirstName = 'Joe';
this.User.LastName = 'Blogs';
//add user to list
var copiedUser = {};
$.extend(copiedUser, this.User);
this.Users.push(copiedUser);
//create new user
this.User = new User();
this.User.FirstName = 'Jane';
//add user to list
var copiedUser = {};
$.extend(copiedUser, this.User);
this.Users.push(copiedUser);
}
}
SomeApp.init();
})();