2

I have a function, say f(args), that is being called from many places in my code.

When args is undefined f() throws an exception.

I would like to identify who called f() with the undefined parameter.

What would be the easiest way to find the exact line (file name + line number) that called f() ?

Is that possible to see the caller in Firebug ?

2
  • 5
    possible duplicate of Javascript how do you find the caller function? Commented Sep 13, 2010 at 14:53
  • 3
    Nope, not a duplicate. The OP specifically mentions Firebug, so this is about the execution environment, not the Javascript language. Commented Sep 13, 2010 at 18:55

3 Answers 3

6

yes. When you breakpoint it. In stack. between watch and breakpoints

Sign up to request clarification or add additional context in comments.

Comments

1

If you need this information without any tool, with a piece of code:

Check out this question

Also,

HERE's an example of writing a backtrace. You could use this for getting the whole trace. (for example if you need the caller of the caller)

Comments

0

If you set a breakpoint in IE developer toolbar, when the breakpoint is hit, you can see the call stack from th script tab, then select the call stack tab on the right. you can click on each stage of the call stack to navigate and inspect all the callers, etc.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.