I am new to programming and javascript. I am having a confusion in the output of below code.
So here in the 1st code, the output is 10 and in 2nd code, the output is 20 how?
var a = 10;
function test() {
a = 20;
return;
function a(){}
}
test();
console.log(a);
var a = 10;
function test() {
a = 20;
return;
}
test();
console.log(a);