title: javaScript: Parsing a stringified object with JSON.parse removes references
body: <p>I am trying to deep-clone an object, say "a" with k = JSON.parse(JSON.stringify(a)). It is important that I use the stringify way, since I am trying to save the object into a file and then load from it. </p>
  
  <p>I stumbled upon a problem with references on the cloned object which is illustrated below:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var obj={};
  obj.importantProperty={s:2};
  obj.c=obj.importantProperty;
  obj.d=obj.importantProperty;
  console.log( obj.c === obj.d ); // Returns true
  
  var cloned = JSON.parse(JSON.stringify(obj));
  console.log( cloned.c === cloned.d ); // Returns false</code></pre>
  </div>
  </div>
  
  I need the references to be kept when using JSON.parse, in the above example they are not. In my project the object is much more complicated, but in the end it comes down to the example above.</p>
  
  <p>Thanks in advance to anyone who helps me with this :)</p>