title: Object copy using Spread operator actually shallow or deep?
body: <p>I understand  spread operators make Shallow copy of objects i.e the cloned object refers to the same reference as the  original object.
  But the actual behaviour seems contradicting  and  confusing.</p>
  
  <pre><code>const oldObj = {a: {b: 10}};
  
  const newObj = {...oldObj};
  
  oldObj.a.b = 2;
  newObj  //{a: {b: 2}}
  oldObj  //{a: {b: 2}}
  </code></pre>
  
  <p>Above behaviour makes sense, newObj is also updated by updating oldObj because they refer the same location.</p>
  
  <pre><code>const oldWeirdObj = {a:5,b:3};
  
  const newWeirdObj = {...oldWeirdObj};
  
  oldWeirdObj.a=2;
  oldWeirdObj      //{a:2,b:3}
  newWeirdObj   //{a:5,b:3}
  </code></pre>
  
  <p>I'm not understanding, why newWeirdObj is not updating similar to oldWeirdObj?
  They are still referring to the same location if i am not wrong, but why is update to oldWeirdObj not updating newWeirdObj ?</p>