First I am not saying deep cloning one object to another.
I have one object:
var data1 = {
               p1: values1,
               p2: values2,
               .....
            };
value1 and value2 can be any data type, like object or array.
I have another object:
var data2 = {
               p3: values3,
               p4: values4,
               .....
            };
value3 and value4 can be any data type, like object or array.
Now I want to clone all data2's properties to data1.
The reason I want this is data1 is referenced, after data1's properties are changed I don't want to breake the reference.
If I do something like
 data1 = clone(data2)
I will break the reference.
Update: What means by breaking the references:
var data1 = {
             p1: value1
          }; 
var data2 = {
              p2: vale2
          };
var ref = data1;
If I do:
data1 = clone(data2);  
Now ref still point to the old data1, its value still be:
{
   p1: value1
}
But I want ref be data2
 
     
     
     
     
    