JavaScript function caller Property Last Updated : 26 May, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report The function.caller property of the JavaScript function object returns the function that invoked the specified function. It returns null if the function "f" was invoked by the top-level code in JavaScript. For functions like strict functions, async functions, and generator functions this method returns null. Syntax: function.caller Parameters: This function does not accept any parameter. Return Value: This function returns null for strict, async function, and generator function callers. A few examples are given below for a better understanding of the function methods. Example 1: This example shows the basic use of the Javascript function.caller property. JavaScript // Creating func2 function func2() { console.log("This is from function 2") } // Creating func1 function func1() { func2(); } // Call Function 1 func1(); // null is returned as function // is strict, async function and // generator function console.log("from function.caller: ", func1.caller) Output: This is from function 2 from function.caller: null Example 2: This example shows the basic use of the Javascript function.caller property. JavaScript function myFunc() { if (myFunc.caller == null) console.log("The function " + "was called from the top!"); else console.log("This function's " + "caller was " + myFunc.caller); } myFunc() Output: The function was called from the top! We have a complete list of Javascript Function methods, to check those please go through this Javascript Function Complete reference article. Browsers Supported: Google Chrome 1 and aboveMicrosoft Edge 12 and aboveMozilla Firefox 1 and aboveInternet Explorer 8 and aboveSafari 3 and aboveOpera 9.6 and above Comment More infoAdvertise with us Next Article Difference between Methods and Functions in JavaScript T tarun007 Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Properties Similar Reads JavaScript Function name Property The function name property of the javascript object is used to return the name of the function. This name property of the function is only readable and cannot be altered. The name of the function which was given when the function was created is returned by Function.name. Syntax: Function.name Proper 3 min read JavaScript Function Call The call() method is a predefined JavaScript method. It can be used to invoke (call) a method with an owner object as an argument (parameter). This allows borrowing methods from other objects, executing them within a different context, overriding the default value, and passing arguments. Syntax: cal 2 min read JavaScript Function.prototype.call() Method The call() method allows function calls belonging to one object to be assigned and it is called for a different object. It provides a new value of this to the function. The call() method allows you to write a method once and allows it for inheritance in another object, without rewriting the method f 3 min read What is the first class function in JavaScript ? First-Class FunctionA programming language is said to have First-class functions if functions in that language are treated like other variables. So the functions can be assigned to any other variable or passed as an argument or can be returned by another function. JavaScript treats function as a fir 2 min read Difference between Methods and Functions in JavaScript Grasping the difference between methods and functions in JavaScript is essential for developers at all levels. While both are fundamental to writing effective code, they serve different purposes and are used in various contexts. This article breaks down the key distinctions between methods and funct 3 min read JavaScript Function Invocation In JavaScript, function invocation refers to executing the code defined in a function. Function invocation occurs when a function is called or executed in JavaScript. When invoked, the code inside the function block is run, and any return value is computed and passed back to the caller.JavaScriptfun 3 min read Like