Question: Subscription Required to Edit and Save Start your free one month trial of Microsoft 3 6 5 or sign in to activate an . .

Subscription Required to Edit and Save
Start your free one month trial of Microsoft 365 or sign in to activate an...
Question 2
With regard to the following JavaScript program,
var x
functiop, subl
documentwrite("x==+x+");
}
function sub
var x ;
x=10
sub10;
s=5;
sub20;
If it is interpreted using static-scoping rules. What value of x is displayed in
function sub1? Why?
If it is under dy
If it is under dynamic-scoping rules, what value of x is displayed in function sub1? Why?
Question 3
Consider the following JavaScript program with static - scoping:
p=x,
}
}
functiop sub3)
?2=7,w=8;
var q=y;Question 2
With regard to the following JavaScript program,
var x ;
function suble )
dacumentwrite(("x ="+ x +"");
functionsub2(){
var x ;
x=10
sub10;
If it is interpreted using static-scoping rules. What value of x is displayed in
function sub1? Why?
If it is under dynamic-scoping rules, what value of x is displayed in function subl? Why?
Question 3
Consider the following JavaScript program with static - scoping
varx=1,y=2
function sub1
}
Answer the questions:
What is the value of z in sub10?
What is the value of y in )?
What is the value of a in sub20)?
What is the value of x in sub2()?
What is the value of a in sub3()?
What is the value of y in sub3()?
Subscription Required to Edit and Save Start your

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!