var a = 50
function x (){
var a = 100
console.log(a,"x----")
function y(){
console.log(a,"y----")
}
return y
}
console.log(a,"---outside")
var z = x()
console.log(x,"---why")
z()
< /code>
The output is:
50 ---outside
100 x----
[Function: x] ---why
100 y----
< /code>
The value of last a inside Y function should be 1000 ?? right what I am wrong
Подробнее здесь: https://stackoverflow.com/questions/795 ... ue-to-1000