How can I return a built-in function as a object property?
<p>This code works, in some cases. If it returns <code>console.log</code> then the call to <code>p.out</code> functions just fine. </p>

<pre><code>function Notice(mode) {
    this.debug = mode;

    this.out = (function() {
            if(mode) {
                if(window.console) {
                    return console.log;
                } else {

                    return alert;
                }
            } else {
                return Notice.doNothing;
            }
    })(mode);
}

var p = new Notice('1');
p.out('Kool-aid, OH YEAH!');
</code></pre>

<p>However, when it returns alert (or window.alert) I get an error:</p>

<pre><code>Error: uncaught exception: [Exception... "Illegal operation on WrappedNative prototype object"  nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)"  location: "JS frame :: http:// .. :: &lt;TOP_LEVEL&gt; :: line 22"  data: no]
</code></pre>

<p>And as a simple test, this works:</p>

<pre><code>out = (function() { return alert; })();
out('hello dolly');
</code></pre>

<p>How can I get obj.out to function properly when its being set to alert?</p>
