...

View Full Version : Debug information in Javascript



MyttO
08-08-2006, 11:37 AM
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.

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

Pyth007
08-08-2006, 02: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).

MyttO
08-08-2006, 10: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 ?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum