How can I create a new instance of variable types in JavaScript?
For example:
var UserControl = { Id: '', Location: { Left: 0, Top: 0, Width: 0, Height: 0 }, Contents: '', Name: '' };
I want to store this UserControl in a JavaScript Array like the following:
UserControl.Id = '1';
UserControl.Location.Left = offset.left;
UserControl.Location.Top = offset.top;
UserControl.Location.Width = offset.left + area.width();
UserControl.Location.Height = offset.top + area.height();
UserControlCollection.push(UserControl);
The issue is that UserControl overwrites the previous entry because it does not create a new instance.
Any ideas on how to resolve this?