lexical_scope
ex1
function f1(){
var a= 10;
f2();
}
function f2(){
return a;
}
f1();
//실행결과
/*
Uncaught Reference Error
: a is not defined
*/혹은
Last updated
Was this helpful?
function f1(){
var a= 10;
f2();
}
function f2(){
return a;
}
f1();
//실행결과
/*
Uncaught Reference Error
: a is not defined
*/Last updated
Was this helpful?
Was this helpful?
function f1(){
var a= 10;
f2();
function f2(){
return a;
}
}
f1();
//실행결과var a = 20;
function f1(){
var a= 10;
f2();
}
function f2(){
return a;
}
console.log(f2());