Question: 7. (10 points) Given this JavaScript like code, under static scoping what will be printed out? Under dynamic binding which will be printed out?
7. (10 points) Given this JavaScript like code, under static scoping what will be printed out? Under dynamic binding which will be printed out? var x; function sub1() { } document.write(x); function sub2() { var x; } x=5; x=10 sub1(); sub2() Static scoping: Dynamic scoping:
Step by Step Solution
There are 3 Steps involved in it
Under static scoping the output will be 5 This is because static scoping also known as lexical s... View full answer
Get step-by-step solutions from verified subject matter experts
