katratxo on Software Development

tail -f /var/log/brain | grep -i software

Development tips: JavaScript debugger statement

with 2 comments

According with the MDC the debugger statement was introduced in ECMA-262, Edition 5

Invokes any available debugging functionality. If no debugging functionality is available, this statement has no effect.

This statement is very handy when trying to debug eval’ed code like the View definition in Openbravo 3.0. It seems the only way to have an entry point to the JavaScript program running in the browser.

I’ve tested this statement in Internet Explorer 8, Firefox 4b10 and Chrome 9. And works when you have a debugger running. Note: In Firefox you need Firebug available for that page.

<script type="text/javascript">
function f() {
 var message = 'hello world';
 if(typeof window.console !== 'undefined') {
 else {

Here you have some screenshots:

Internet Explorer
Internet Explorer - JS debugger

Firefox/Firebug - JS debugger

Chrome/Chromium - JS debugger


Written by katratxo

February 10, 2011 at 8:04 pm

Posted in Openbravo

Tagged with , ,

2 Responses

Subscribe to comments with RSS.

  1. When debug some javascript like searchs.js, the code is a mess, how could I arrange and ident this code to properly debug???

    Adrian Herrera Montenegro

    September 10, 2011 at 1:21 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: