I'm setting one array like so...

Code:
var myArray = [
     { 'Name' : 'Bob',
     'Hats' : [
          { 'Color' : 'Green' },
          { 'Color' : 'Red' },
          { 'Color' : 'Blue' }
     ]
     },
     { 'Name' : 'Tim',
     'Hats' : [
          { 'Color' : 'Yellow' },
          { 'Color' : 'Purple' }
     ]
     }
];
And then I set another variable with the contents of myArray like so...

Code:
var anotherArray = myArray.slice();
When I remove myArray[1], for example, anotherArray[1] stays the same. However, when I remove a Hat the hat is removed from both.

I'm assuming that slice() takes care of the top level arrays but the nested ones still are linked. Maybe?

Just trying to find a (hopefully) simple solution to stop the syncing. Thanks!