Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2005
    Location
    France, Bordeaux
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Debug information in Javascript

    Is there a way to retrieve the current execution line, file, or function in Javascript?
    For those who work server side, it would be an equivalent to __LINE__ and __FILE__ for instance.

    This would be very useful for writing debugging tools like assert() etc.

  • #2
    New Coder
    Join Date
    Mar 2005
    Location
    France, Bordeaux
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts
    To prevent from wrong debates, I'm not looking for a whole debugging environment like Venkman, which is really great by the way...

  • #3
    Regular Coder
    Join Date
    Sep 2005
    Posts
    535
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Depending on your browser, yes. Firefox has a Javascript Console that not only lists files and line-numbers, but also provides some pretty good info on what the problem might be. It also has messages about css errors as well as general warnings. I think some other browsers also have similar tools (IE being the biggest exception).
    If you want answers, write a smart question.

    Yes, someone probably does know how...

    Oh, and if you want to learn, STFW!

  • #4
    New Coder
    Join Date
    Mar 2005
    Location
    France, Bordeaux
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question I meant code...

    Sorry if I was unclear, let me reformulate:

    Is there Javascript code to retrieve such information, just like the __FILE__ and __LINE__ constants in PHP ?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •