Does anybody know chrome extension, that helps detect console.log
in javascripts on page?
If console.log
call without checking, page crashed, and script not working. But i often put console.log
for debugging, and sometimes i can forgot delete it.
An easy fix is to always include a piece of javascript similar to this:
if (typeof(console) == "undefined") {
console = {log: function() {}};
}
Override console.log , and use your own function to debug.
function debug(d){ // debug function. console.log or alert
if(off == 0){
if(typeof(console) != 'undefined'){
if(typeof(console.log) == 'function'){
console.log(d);
}
}else{
alert(d);
}
}
};
Set var Off = 0 , when you need to off validations.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.