/ DEVELOPMENT,Sencha,WEB Javascript: Debug Console

Javascript: Debug Console

Many developers still use alert boxes to check their JavaScript code. And yet there is a Javascript console in most browsers: Google Chrome, Firefox (with Firebug), Internet Explorer, Opera (with the Developer Console tool) and Safari.
For example in IE8, you can access IE8 script console by launching the “Developer Tools” (F12). Click the “Script” tab, then click “Console” on the right.

Here is a simple function to check if the console is turned on before writing the text. Otherwise, an alert box is displayed:

function writeInJsConsole (text) { 
    if (typeof console !== 'undefined') { 
    } else { 


But, this JS console allows other methods:

console.log("hello world from js to ie8 console");"sample info"); 
console.error("sample error"); 
console.warn("sample warning"); 
var x = "hello"; var y = 10; var z=1.1; 

and the results in console could be:

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

Related Post