Function caller

caller property contains a reference to the function that called this function or null if the function was called from the global scope.

 
<!DOCTYPE html>
<html>
<head>
    <title>Example</title>
    <script type="text/javascript">
        function outer(){ 
            inner(); 
        }
        function inner(){ 
            document.writeln(inner.caller); 
        } 
        
        outer(); //function outer(){ inner(); }
        inner();//null
        
       
    </script>
</head>
<body>
</body>
</html>
  
Click to view the demo
 
<!DOCTYPE html>
<html>
<head>
    <title>Example</title>
    <script type="text/javascript">
        function outer(){ 
            inner(); 
        } 
        
        function inner(){
            document.writeln(arguments.callee.caller); 
        
        } 
        outer(); 
        inner();
    </script>
</head>
<body>
</body>
</html>
  
Click to view the demo
Home 
  JavaScript Book 
    Essential Types  

Function:
  1. The Function Type
  2. Function Declarations versus Function Expressions
  3. Functions as Values
  4. Returning a function from a function
  5. Function arguments
  6. this for function context
  7. Function caller
  8. Function length property
  9. Function apply()
  10. Function.call() method
  11. Function's bind() method
  12. Function toLocaleString() and toString()