title: Cloning an Object in Node.js
body: <p>What is the best way to clone an object in node.js</p>
  
  <p>e.g. I want to avoid the situation where:</p>
  
  <pre><code>var obj1 = {x: 5, y:5};
  var obj2 = obj1;
  obj2.x = 6;
  console.log(obj1.x); // logs 6
  </code></pre>
  
  <p>The object may well contain complex types as attributes, so a simple for(var x in obj1) wouldn't solve.  Do I need to write a recursive clone myself or is there something built in that I'm not seeing?</p>