What is displayed when myFunction(true) is called?

Refer to code below:

Function muFunction(reassign){

Let x = 1;

var y = 1;

if (reassign) {

Let x= 2;

Var y = 2;

console.log(x);

console.log(y);}

console.log(x);

console.log(y);}

What is displayed when myFunction(true) is called?
A . 2211
B . 2 2 undefined undefined
C . 2212
D . 2222

Answer: C

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments