title: How do I correctly clone a JavaScript object?
body: <p>I have an object <code>x</code>. I'd like to copy it as object <code>y</code>, such that changes to <code>y</code> do not modify <code>x</code>. I realized that copying objects derived from built-in JavaScript objects will result in extra, unwanted properties. This isn't a problem, since I'm copying one of my own literal-constructed objects.</p>
  
  <p>How do I correctly clone a JavaScript object?</p>