In prototype.js you can create classes e.g. like this:
var MyClass = Class.create(
{
initialize: function (par1, par2)
{
this.data = $R(par1, par2).toArray();
}
});
and instantiate them through
var myObj = new MyClass(1, 7000);
Now, how can I copy this object? The following does not work:
var myObj2 = MyObj.clone();
In my specific case, I only need a shallow copy, i.e. the attributes of the instance can reference the same objects. Some way of defining a copy constructor would certainly be the most versatile option.
Is that possible? (Preferably without relying on prototype.js internals)