Javascript IIFE , Objects : <p>Please give me some link to help me understand this </p>

<pre><code>    var obj = {
  a: 1
};
(function(obj) {
  obj = {
    a: 2
  };
})(obj);
console.log(obj.a);
</code></pre>

<p>logs out 1 whereas this </p>

<pre><code>var obj = {
  a: 1
};
(function() {
  obj = {
    a: 2
  };
})();
console.log(obj.a);
</code></pre>

<p>logs out 2</p>
