Question 8
Consider the below javascript program.
function parent() { var a = 1; function child() { console.log(a); } a = 2; return child;}
var closure = parent();closure();What will be the output of the above program, if executed?
2
1
undefined
Error