I've got stuck with this issue.
var myModule = (function(){
    var foo;
    foo = "bab"; 
    console.log(foo);
    foo = "bab" + "more";
    console.log(foo);
    function mth1(){
      foo = "mag";
      console.log(foo);
    }
    return{
      pubMethod1: mth1 
    };
})();
myModule.pubMethod1();
The problem is that instead of this output:
"bab"
"bab more"
"mag"
I get this output:
"bab"
"mag"
"mag"
More specifically, the "bab more" is for some reason overwritten by mth1() value.
Original code publishing is not available.
Your thoughts much appreciated.
 
    