What will be the output of the below code :-
var a = 90;
doit();
function doit(){
console.log(a);
var a = 10;
}
Output of above will be undefined as inside function doit,variable 'a' will be hoisted at the top inside function scope and it will initialised as undefined.
var a = 90;
doit();
function doit(){
console.log(a); // undefined
var a = 10;
}