Question: Question 1 With regard to the following JavaScript program, function main ( ) { function sub 1 0 var x = 1 0 ; function

Question 1
With regard to the following JavaScript program,
function main(){
function sub10
var x =10;
function sub20{
var y = x;
}
function sub30
var x =5;
var x =20;
}
If it is interpreted using static-scoping rules. What value of x is displayed in
functions sub1, sub2, and sub3 respectively? Why?
If it is under dynamic-scoping rules, what value of x is displayed in functions sub1, sub2,
and sub 3 respectively? Why?
Question 1 With regard to the following

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 Programming Questions!