Reputation: 2356
I can see many place used console.log()
. Can anyone tell me why it is used?
Something like this,
function createCheckBox( idsToShow ) {
for( i = 0 ; i < 15 ; i++ ) {
console.log( idsToShow.indexOf('main' + i + '|' ) + ' ' + 'main' + i + '|' );
if( idsToShow != '' && idsToShow.indexOf('main' + i + '|' ) == -1 ) continue;
checkBoxs += "<li> <input type=\"checkbox\" id=\"main" + i + "\" value=\"Example" + i + "\" name=\"lbl"+ i +"\" /> <label id=\"lbl"+ i +"\">Example" + i + "</label></li>";
ids += 'main' + i + '|'; //is the check box id.
}
}
Upvotes: 6
Views: 3373
Reputation: 1206
Everyone seems to use log, but console.info is more useful. In Firebug it gives you the line number where it came from, so you don't have to be so descriptive in the console message. It's also much easier to track down if a colleague leaves an errant console somewhere in your site.
Upvotes: 1
Reputation: 795
you can use console.log to show you the log of every executed line and debugger; at certain line to break the execution of script, provided you are using firebug or any other developer tools.
Upvotes: 0
Reputation: 5572
console
is a debug handler found in many browsers. For more retarded browsers you could try FauxConsole.
Upvotes: 0
Reputation: 943556
It logs things to a debug console (which is built into many browsers (e.g. Chrome Developer Tools) and available as an extension (e.g. Firebug for Firefox) in many others)
Upvotes: 10