What types of areas exist in Javascript?

I understand that there is a global scope and an additional functional scope. But are there any other types of areas or closures in Javascript?

While we are talking about the topic, what is the difference between area and closure?

0
source share
1 answer

A closure is a stack of visible areas. Say you have the following code:

var v1;
function a() {
    var v2;
    function b() {
        var v3;
        function c() {
            var v4;
        }
        return c;
    }
    return b();
}
var f = a();

c - , 4 : ( v4 ), b ( v3 ), a ( v2), ( v1 ). , . c b a , , f, , , f(), , , , . , - . , , scope vars - - , . , .

+1

All Articles