# JavaScript console

All modern desktop browsers provide features to support developers debugging JavaScript. While the browsers do not directly integrate true debugging support, they usually support directing JavaScript error messages and logging statements to either a console display or popup messages. Mozilla Firefox supports this feature.

Consider the following trivial example of a web page with a JavaScript error. It calls the method `document.writex()` which does not exist.

    <html>
    <body>
    <script language = "JavaScript">
    document.write('Testing1<br/>\n');
    document.writex('Testing2<br>\n');
    </script>
    Test Page
    </body>
    </html>

- SETTINGS

Go to Web > Settings > General and select the following option

• Java/ECMA Script

This option provides you support to enable/disable JavaScript.

Enable | Enable JavaScript Console Support
Disable | Disable JavaScript Console Support

• Java/ECMA Script errors

This option provides you choices to display and log errors.

No Notification | Enable JavaScript Console Support
Create Log file | It will create log file to the `C:\Data` folder of SDK
Show pop-up notes | It will show pop-up notes on the emulator screen
Log and pop-up notes | It will show pop-up notes and create logs to `C:\Data` folder of the SDK

- ERROR SCENARIO

Try to run the JavaScript example that has an error. Just like an ordinary browser, it will display error message based on your selected criteria from the web settings.

- HOW TO USE

Below is the functional description of how this feature can be used.

1. An option for JavaScript console is added to the Browser settings. There are three options for this setting: Disable, Prompt and Log.

   - When the Disable option is selected, the JavaScript console for browser / widgets are disabled.

   - When the Prompt option is selected, JavaScript errors and exceptions are presented in a popup dialog

   - When the Log option is selected, JavaScript errors and exceptions are logged into a text file that is placed in a user accessible area of the device’s file system. For example, `C:\data`

2. JavaScript console supports `console.log` for logging messages to the console