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);
}

Share and Enjoy:
  • Twitter
  • Facebook
  • Digg
  • Google Bookmarks
  • LinkedIn
  • StumbleUpon
  • FriendFeed
  • Yahoo! Buzz
  • RSS
  • email

Related posts:

  1. Executing Javascript in Java code
  2. Javascript syntax validation
  3. Covariant return types
  4. Class Loading in Java


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.


Get Adobe Flash playerPlugin by wpburn.com wordpress themes