๋ฐ์ํ
์์ 1) result ๊ฐ์?
let x = 10;
function outer () {
x = 20;
function inner () {
x = x + 20;
}
inner();
}
outer();
let result = x;
์์ 2) result ๊ฐ์?
let x = 10;
function outer () {
x = 20;
function inner () {
let x;
x = x + 20;
return x;
}
inner();
}
outer();
let result = x;
์์ 3) result ๊ฐ์?
let x = 10;
function outer () {
let x = 20;
function inner () {
x = x + 10;
return x;
}
inner();
}
outer();
let result = x;
๐
๐
๐
๐
๐
๐
๐
๐
๋ต
์์ 1 => 40
์์ 2 => 20
์์ 3 => 10
๋ฐ์ํ