'What is the difference between public and Local scope [duplicate]
function b() {
console.log(myvar);
}
function a() {
var myvar = 2;
console.log(myvar);
b();
}
var myvar = 1;
console.log(myvar);
a();
console.log(myvar);
Why output of console log of myvar in function b is 1 not 2?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
