JS Function Caller

Helpful little JS trick, need to know caller function?



arguments.callee.caller.toString();


 

Bookmark and Share
  1. Michael Brennan-White

    #1 by Michael Brennan-White - January 27, 2012 at 7:00 AM

    Good to know. If I wanted to just get the function name that was called could I just do arguments.callee.toString(); ?
  2. erik

    #2 by erik - January 31, 2012 at 3:56 PM

    Possibly!... I havent tried it, as i was looking for the caller. Makes sense though give it a shot!
(will not be published)