Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following JavaScript program: var x, y, x; function sub1 () { var a

ID: 3757888 • Letter: C

Question

Consider the following JavaScript program:

var x, y, x;

function sub1 ()

{

      var a, y, z;

      function sub2 ()

      {

        var a, b, z;

        . . .

      }

        . . .

}

function sub3 ()

{

      var a, x, w;

      . . .

}

Variable                                      Where Declared List all the variables, along with the program units (sub1, sub2, sub3) where they are declared, that are visible in the bodies of sub1, sub2, and sub3, assuming static scoping is used.

In sub1:

In sub2:

In sub3:

      

  

Explanation / Answer

In sub1:
x,y,a,z

In sub2:
x,y,a,z,b

In sub3:
x,y,a,w