I won't say anything, just a look at the code is enough:
JS:
var myvar = "my value";
(function (){
console.log(myvar); //returning undefined
var myvar = "local value";
})();
Now a very simple question: The variable myvar
is declared before the execution of the function, so why is the console showing undefined?