ProAnswers.org

What are the three level of execution context?

The following code has three level of execution context:

        var name = "JavaScript"; 

        function changeName(){ 

           var anotherName = "HTML";

           function swapNames(){ 

              var tempName = anotherName; 

              document.writeln("tempName:"+tempName);

              anotherName = name; 

              name = tempName;

              //name, anotherName, and tempName 

              //are all accessible here 

           }

           //name and anotherName are accessible here, 

           //but not tempName 

           swapNames(); 

        } 

        //only name is accessible here 

        changeName(); 

        document.writeln(name);//HTML