title: Why javascript date.setDate() change the value of other date variables
body: <p>When i'm trying to know functionality of setDate() ,setTime() of javscript date i came across this problem.</p>
  
  <pre><code>&lt;script&gt;
  var date1 = new Date();
  var date2 = new Date(1991,4,11);
  var date3 = new Date(1992,4,11);
  
  date3 = date1;
  date2 = date1;
  date2.setDate(date2 .getDate() + 40);//im changing only date2 value using setDate()  
  
  //print values
  
  &lt;/script&gt;   
  </code></pre>
  
  <p>I think the result will be like:<br>
  Fri Jul 04 2014<br>
  Wed Aug 13 2014<br>
  Fri Jul 04 2014</p>
  
  <p>But in output all date variables have same value:  </p>
  
  <p>Wed Aug 13 2014</p>
  
  <p>Wed Aug 13 2014</p>
  
  <p>Wed Aug 13 2014</p>
  
  <p><a href="http://jsfiddle.net/Manirajss/4dSCf/" rel="noreferrer">jsfiddle</a></p>
  
  <p>If i do similar kind of code with integer variables they work like as i think(all int variables have different values).</p>
  
  <p><strong>Summary of Questions</strong>    </p>
  
  <ol>
  <li>How date assignment and number assignment differs?</li>
  <li>Why and how javascript setDate() tracking other date variables? </li>
  <li>Last but not least <strong>What i have to do if i want to change only date2 value with these assignments?</strong></li>
  </ol>
  
  <p>Thanks in Advance.</p>