Question: Scope The following code snippet contains two console.log() statements. Choose the correct output corresponding to each statement, considering that each statement is executed individually. var
Scope
The following code snippet contains two console.log() statements. Choose the correct output corresponding to each statement, considering that each statement is executed individually.
var x = 22;
var a = 5, b;
function foo() {
var y = 7;
b = 2;
}
console.log(x / y);
console.log(a / b);
A. 3.142857142857143
2.5
B. 3.14 undefined
C. Uncaught ReferenceError: y is not defined
2.5
D. Uncaught ReferenceError: y is not defined
NaN
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
