How do functions work in JavaScript & Variable Environment?
Guess what is the output of the program?
1 var x = 10;
2 a();
3 b();
4 console.log(x);
5 function a() {
6 var x = 100;
7 console.log(x);
8 }
9 function b() {
10 var x = 1000;
11 console.log(x);
12 }
Output is:
100
1000
10
Why do we ...
lovishduggal.hashnode.dev3 min read