Exam4Training

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 . 2 2 1 1
B. 2 2 undefined undefined
C. 2 2 1 2
D. 2 2 2 2

Answer: C

Exit mobile version