0

Is there any way I can view the variables used in a javascript function without trawling through the code?

Using javascript on a server so cant really install an app to debug, is there a javascript function i can use in some way?

3
  • So, you are not in a web browser? Are you executing this javascript on the command line? Commented Feb 3, 2010 at 15:54
  • Do you mean you want to see what variable are used, or their values? By "using javascript on a server" do you mean the JS is executing on the server, or is the server sending JS to a browser for execution? (The 2nd is way more common.) Commented Feb 3, 2010 at 15:56
  • What is the real problem you're trying to solve? In other words, what is it that you think would be useful about "viewing the variables used in a javascript function"? What sort of bug are you trying to diagnose? Commented Feb 3, 2010 at 16:01

1 Answer 1

1

Not unless the JavaScript implementation you're using has some extension that provides such a feature (browsers don't). JavaScript resolves identifiers inside a function using the scope chain; there's no single object that contains all the variables in scope, and the objects in the scope chain are inaccessible from code.

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

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.