Setting object by value instead of reference
<p>I'm trying to init a var in JS with date from another JS object but whatever i am trying getting reference to the old object (pointer) and I need it not to change.</p>

<pre><code>var lastActionDate = new Date(mainLastActionDate);
var nowDate = new Date();
var tmpLastActionDate = lastActionDate;

if ((tmpLastActionDate.setDate(tmpLastActionDate.getDate() + 7)) &gt; nowDate)
</code></pre>

<p>The last line is the problematic line. I thought that lastActionDate should not be changed and i need it to stay with the old date, but it changes with tmpLastActionDate and i am guessing because it is a pointer.</p>

<p>How can one set a date object by value instead of reference?</p>
