a = 10;
function abc() {
console.log(" a is " + a);
var a =5;
console.log("after a is " + a);
}
abc();
In this code above , my first console.log is showing a
as undefined whereas the second console.log is showing the result of a
as 5.
I am still trying to understand why my first console is showing a
as undefined. I already defined variable a
as a global variable.