Question: Consider the following javascript program. var a = 0; function f() { // Spot 1 function g() { function h() { // Spot 2

Consider the following javascript program. var a = 0; function f() { // Spot 1 function g() { function h() { // Spot 2 } h(); } function i() { var a = 5; // Spot 3 function j(){ // Spot 4 function m() { var a = 10; g(); } m(); } function k() { var a = 7; jO; } k(); } i(); } Open in A f(); (a) For each "Spot" in the comments, specify which "a" is visible. (You may use the value assigned to that "a" to identify it.) (b) For each "a" specify the lifetime. How is this different from the scope? (c) Suppose the above code used dynamic scoping, rather than static scoping. For each "Spot" which "a" is visible?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
