View Full Version : Debug information in Javascript

08-08-2006, 12:37 PM
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.

08-08-2006, 12:54 PM
To prevent from wrong debates, I'm not looking for a whole debugging environment like Venkman, which is really great by the way...

08-08-2006, 03:43 PM
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).

08-08-2006, 11:07 PM
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 ?