console.log is not a function in nodejs 6.9.1
<p>I met a weird problem when I try to understand the code in the Javascript:The Good Parts. I try to use console.log() to print something, but I just get TypeError, my code is here:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>Function.prototype.method=function(name,func){
    this.prototype[name]=func;
    return this;
}

Function.method('bind',function(that){
    var method=this;
    var slice =Array.prototype.slice;
    var args=slice.apply(arguments,[1]);

    console.log(that);//error: console.log is not a function

    return function(){
        return method.apply(that,args.concat(slice.apply(arguments,[0])));
    };
});

var x=function(){
    return this.value;
}.bind({value:666});

console.log(x());</code></pre>
</div>
</div>
</p>

<p>and the error message is blow:</p>

<pre><code>/home/wz/code/js/c.js:14
    console.log(that);//error: console.log is not a function
            ^

TypeError: console.log is not a function
    at Function.&lt;anonymous&gt; (/home/wz/code/js/c.js:14:13)
    at new Console (console.js:34:23)
    at console.js:100:18
    at NativeModule.compile (bootstrap_node.js:497:7)
    at Function.NativeModule.require (bootstrap_node.js:438:18)
    at get (bootstrap_node.js:254:34)
    at Function.&lt;anonymous&gt; (/home/wz/code/js/c.js:14:5)
    at Object.&lt;anonymous&gt; (/home/wz/code/js/c.js:23:3)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)

Shell 已返回1
</code></pre>

<p>It is so interesting when I run the snippet in stackoverflow it works as I expected... So it seems that there are some bugs in my native environment?</p>

<p>I try to use fs to save the console.log into file to see what actually it is in my code, I change the code to:</p>

<pre><code>fs=require('fs');
Function.prototype.method=function(name,func){
    this.prototype[name]=func;
    return this;
}

Function.method('bind',function(that){
    var method=this;
    var slice =Array.prototype.slice;
    var args=slice.apply(arguments,[1]);

    fs.writeFile('a.txt',String(console.log));
    //console.log(that);//error: console.log is not a function

    return function(){
        return method.apply(that,args.concat(slice.apply(arguments,[0])));
    };
});

var x=function(){
    return this.value;
}.bind({value:666});

console.log(x());
</code></pre>

<p>and in the a.txt:</p>

<pre><code>function (){
        return method.apply(that,args.concat(slice.apply(arguments,[0])));
    }
</code></pre>

<p>So amazing that console.log becomes the returned object... I was totally confused.
I have tried node 6.9.1 and 4.6.1 and I got the same result. And I use nvm to manage my node version</p>