Question: Consider the following JavaScript skeletal program: function main() { var a, b, c; function sub1() { var x, y, w; function sub2() { var a,

Consider the following JavaScript skeletal program:

function main() { var a, b, c; function sub1() { var x, y, w; function sub2() { var a, d; ... } ... } function sub3() { var c, u, z; ... } }

a. List all the variables, along with the program units (sub1, sub2, sub3, or main) where they are declared, that are visible in the body of main, assuming static scoping is used. b. List all the variables, along with the program units (sub1, sub2, sub3, or main) where they are declared, that are visible in the body of sub1, assuming static scoping is used. c. List all the variables, along with the program units (sub1, sub2, sub3, or main) where they are declared, that are visible in the body of sub2, assuming static scoping is used. d. List all the variables, along with the program units (sub1, sub2, sub3, or main) where they are declared, that are visible in the body of sub3, assuming static scoping is used.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!