假设我有:
var obj1 = {
'0': 'a',
'1': 'b'
}
var obj2 = obj; // I want to create a new object with obj contents
obj1[2] = 'c' // Now I modify obj without modifying obj2
obj1 = obj2; // so I can restore obj later
但是修改 obj 也会修改 obj2。如何创建独立于它的 obj1 的副本?