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.
}
}
The console.log() is a function in JavaScript that is used to print any kind of variables defined before in it or to just print any message that needs to be displayed to the user. Syntax: console.log(" "); Parameters: It accepts a parameter that can be an array, an object, or any message.
It shows the source of an operation, what triggered the operation, and what occurred next. Use this tool to inspect debug logs that include database events, Apex processing, workflow, and validation logic. To learn more about working with logs in the Developer Console, see Log Inspector in the Salesforce online help.
We already know that logging is affecting performance, especially when we use console. log because its a syncronous process. In nodejs, we have to use asyncronous process to get the best performance.
log is used mainly for debugging. It is used to display something on the console.
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)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With