What is the proper way to detect the presence of window.console?
<p>I have this bit of code:</p>

<pre><code>            var has_logger = (window.console &amp;&amp; window.console.log);
            if (has_logger) {
                window.console.log(data);
            }
</code></pre>

<p><code>has_logger</code>, instead of being a boolean value, is actually initialised to a function object ( <code>function log() { [native code] }</code> )</p>

<p>My questions:</p>

<ul>
<li><p>There is no need to test for the console.log in modern browsers, correct?</p></li>
<li><p>What is the proper way to initialize <code>has_logger</code> to a boolean value instead of a function object?</p></li>
</ul>
