I would like to override console.log and call it on my new function.
I try something like this but I get Uncaught TypeError: Illegal invocation:
Uncaught TypeError: Illegal invocation
You are invoking the console.log function on the window object. You should instead invoke it on the console object.
console.log
window
console
console.log = function() { this.apply(console, arguments); }.bind(console.log); console.log('as');