Javascript interview snippets
Jan 17, 2023
Q1. Guess the Output:
var b = 1;
function outer(){
var b = 2
function inner(){
b++;
var b = 3;
console.log(b)
}
inner();
}
outer();
Take a deep breath , don’t jump into solution
Output:
3
Q2. Guess the Output:
var x = 21; var girl = function () { console.log(x); var x = 20; }; girl ();
Take a deep breath , don’t jump into solution
Output:
undefined