Aryan PrajapatKnowledge Contributor
How many alert dialogs will the following Javascript generate, and what will be displayed in each of them? var x = “20”; function func1(){ var x = “5”; alert(this.x); function func2(){alert(x);} func2(); } func1();
How many alert dialogs will the following Javascript generate, and what will be displayed in each of them? var x = “20”; function func1(){ var x = “5”; alert(this.x); function func2(){alert(x);} func2(); } func1();
Ans: A. There will be 2 alert dialogs. The first will display “20”, and the second will display “5”.