function f() {
var b = "b";
return function() {
alert(b);
return b;
};
}
var a = function f();
alert(a);
I try to run this code but I have error which I don’t understand.
Error:
Problem at line 8 character 21: Expected '{' and instead saw ';'.
var a = function f();
Problem at line 8 character 21: Unnecessary semicolon.
var a = function f();
Problem at line 8 character 22: Missing semicolon.
var a = function f();
Implied global: alert 4,9
what wrong in this code I want to alert the the privete var from the global scope.
what I should change ?
Many thx.
That doesn’t make any sense.
If you’re trying to call the function, just write
f().