Skip to main content
edited body
Source Link
Phillip Senn
  • 47.8k
  • 92
  • 262
  • 381

The name of the calling function can be obtained via the deprecated arguments.callee.caller.name property MDN: arguments.callee.

Another method is by parsing the value of new Error().stack.

In Chrome you can use:

var stackTrace = {}:;
Error.captureStackTrace(stackTrace); // Get the stack trace
stackTrace = stackTrace.stack;       // Formatted string

The name of the calling function can be obtained via the deprecated arguments.callee.caller.name property MDN: arguments.callee.

Another method is by parsing the value of new Error().stack.

In Chrome you can use:

var stackTrace = {}:
Error.captureStackTrace(stackTrace); // Get the stack trace
stackTrace = stackTrace.stack;       // Formatted string

The name of the calling function can be obtained via the deprecated arguments.callee.caller.name property MDN: arguments.callee.

Another method is by parsing the value of new Error().stack.

In Chrome you can use:

var stackTrace = {};
Error.captureStackTrace(stackTrace); // Get the stack trace
stackTrace = stackTrace.stack;       // Formatted string
edited body
Source Link
Rob W
  • 350.4k
  • 87
  • 811
  • 683

The name of the calling function can be obtained via the deprecated arguments.callee.caller.name property MDN: arguments.callerarguments.callee.

Another method is by parsing the value of new Error().stacknew Error().stack.

In Chrome you can use:

var stackTrace = {}:
Error.captureStackTrace(stackTrace); // Get the stack trace
stackTrace = stackTrace.stack;       // Formatted string

The name of the calling function can be obtained via the deprecated arguments.callee.caller.name property MDN: arguments.caller.

Another method is by parsing the value of new Error().stack.

In Chrome you can use:

var stackTrace = {}:
Error.captureStackTrace(stackTrace); // Get the stack trace
stackTrace = stackTrace.stack;       // Formatted string

The name of the calling function can be obtained via the deprecated arguments.callee.caller.name property MDN: arguments.callee.

Another method is by parsing the value of new Error().stack.

In Chrome you can use:

var stackTrace = {}:
Error.captureStackTrace(stackTrace); // Get the stack trace
stackTrace = stackTrace.stack;       // Formatted string
Source Link
Rob W
  • 350.4k
  • 87
  • 811
  • 683

The name of the calling function can be obtained via the deprecated arguments.callee.caller.name property MDN: arguments.caller.

Another method is by parsing the value of new Error().stack.

In Chrome you can use:

var stackTrace = {}:
Error.captureStackTrace(stackTrace); // Get the stack trace
stackTrace = stackTrace.stack;       // Formatted string