I'm trying to get variable d value from function b in function e, but the result not value from function b. The result just from variable outside the function b.
var d = "maybe";
var a = 1;
function b() {
if (a == 1) {
var d = "yes";
} else {
var d = "no";
}
}
b();
function e() {
console.log(d); //output maybe
}
e();
How do I get the result to be the value from function b, or equal to "yes"?