Please give me some link to help me understand this
var obj = {
a: 1
};
(function(obj) {
obj = {
a: 2
};
})(obj);
console.log(obj.a);
logs out 1 whereas this
var obj = {
a: 1
};
(function() {
obj = {
a: 2
};
})();
console.log(obj.a);
logs out 2