Javascript push object as clone
<p>I use d3 for a interactive network application. The data I need to bind changes during the interaction and consists of some selected objects from my JSON variable.<br>
For that I used map on the JSON variable and made some queries to select the appropriate objects. The objects are pushed onto a list and this list is bound as new data.<br>
My problem is, that Javascript pushes objects just as reference. While d3 makes some fancy data modifications my JSON variable gets messy and my queries won't work anymore.<br>
Do I need to copy each object with something like <code>JSON.stringify()</code> or <code>jQuery.extend()</code> or is there a different solution to decouple my JSON variable from the array of objects I pass as data?</p>