Question: 2. Consider the following JavaScript example: function main) function subl ) { function sub2 )f var a, d, e; var b, c function sub3 (

 2. Consider the following JavaScript example: function main) function subl )

2. Consider the following JavaScript example: function main) function subl ) { function sub2 )f var a, d, e; var b, c function sub3 ( var c, d; var a, b (a) Assume that static scoping is used. List all variables, along with the functions in which they are declared, that are visible in the body of subl. (b) Repeat part (a), but list the variables that are visible in the body of sub2. (c) Repeat part (a), but list the variables that are visible in the body of sub3. (d) Assume that dynamic scoping is used, and that main calls sub3, which then calls subl, which then calls sub2. List all variables, al are declared, that are visible in the body of subl. (e) Repeat part (d), but list the variables that are visible in the body of sub2. ong with the functions in which they Repeat part (d), but list the variables that are visible in the body of sub3. () A sample answer to one part of the problem might look like this: a (declared in main), b (declared in subl), d (declared in sub3)

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!