Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started