Skip to content


Caller information in Javascript

Posted in Javascript, Technology.

Caller - Returns the function that invoked the specified function.

Not a standard javascript function but implemented in Mozilla engine and JScript.

If the function f was invoked by the top level code, the value of f.caller is null, otherwise it’s the function that called f.

Example: Checking the value of a function’s caller property

The following code checks the value a function’s caller property.

function myFunc() {
if (myFunc.caller == null)
{
return (“The function was called from the top!”);
}
else return (“This function’s caller was ” + myFunc.caller);
}

Note from Author :
I maintain my website, write articles and reply comments because of my interest/hobby to share information and knowledge.

If you liked the post, Please
Follow me on twitter: http://twitter.com/pankajbatracom
Join My facebook page: http://www.facebook.com/pankajbatra.blog
Join me on LinkedIn: http://www.linkedin.com/in/batrapankaj
Or subscribe to updates by Email by clicking here

To subscribe for updates, Enter your email address:

Related posts:

  1. Executing Javascript in Java code
  2. Facebook Email in response to Google Gmail Buzz
  3. Javascript syntax validation


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.







Some HTML is OK

or, reply to this post via trackback.