I'm using an Array as a container for some basic boilerplate objects which can be copied and added to another Array and then modified. The problem is when I assign the new array ownership of the object any changes persist down to the original object (which shouldn't change).
An example:
var originals = [{ name: "One", value: 1 }, { name: "Two", value: 2 }, { name: "Three", value: 3 }];
var notOriginal = [];
notOriginal.push(originals[0]);
// THIS GIVES ME - notOriginal = [{ name: "One", value: 1 }];
notOriginal[0].name = "Uno";
// THIS RESULTS IN - originals = [{ name: "Uno", value: 1 },...];
I'm trying to keep the "originals" variable the same - it shouldn't change.
I've googled quite a bit and tried some things but not sure where to find a solution.
Specifically this is happening in VueJS whereas the object is in my data()