I have this bit of code:
var has_logger = (window.console && window.console.log);
if (has_logger) {
window.console.log(data);
}
has_logger, instead of being a boolean value, is actually initialised to a function object ( function log() { [native code] } )
My questions:
-
There is no need to test for the console.log in modern browsers, correct?
-
What is the proper way to initialize
has_loggerto a boolean value instead of a function object?
If Firebug is not enabled, Firefox will throw an error if you don’t check.
will always be Boolean.