Javascript Uncaught TypeError: Illegal invocation
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/9612398/chrome-doesnt-recognize-console-log-when-its-called-log">Chrome doesn’t recognize console.log when it’s called log</a>  </p>
</blockquote>



<p>Can anyone tell me why this doesn't work when I set the method to <code>console.log</code>?</p>

<pre><code>var met = "console.log";
var msg = "HELLO WORLD";
var n = met.split(".");
var f = this;
$.each(n, function(k, v){
    f = f[v];
});
f(msg);
</code></pre>

<p>this seems to work when I tried using <code>alert</code></p>
