Sometimes, the developer may want to modify how a function works on the basis of its caller function. To find out the caller function name, we will use the Function object’s caller property.
Here, the Function object is replaced by the name of the function of which we want to know the parent function name.
Let’s take a look at an example:
When the above code is executed, we can see the name of the parent function being logged out.
Let’s take a look at another example:
Suppose we call the
Foo function from multiple functions.
You can know more about the parent function from the property Function.caller
- How to find out where a function is defined using PHP ?
- CSS | :out-of-range Selector
- How to get random value out of an array in PHP?
- Android Fade In/Out in Kotlin
- How to reverse an animation on mouse out after hover?
- How to create responsive website zoomed out to full width on mobile using Bootstrap?
- List out all the Shells Using Linux Commands
- How to display popup message when logged out user try to vote ?
- Implement Zoom In or Zoom Out in Android
- First In Never Out (FINO) scheduling in Operating System
- How to link back out of a folder using the a-href tag?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.