¡@

Home 

2014/10/16 ¤W¤È 12:10:21

jquery Programming Glossary: window.log

Chrome doesn't recognize console.log when it's called log

http://stackoverflow.com/questions/9612398/chrome-doesnt-recognize-console-log-when-its-called-log

I'm lazy. So in my utils.js there's a simple line window.log console.log This works fine in firefox but it makes Chrome cry.. pays attention to what this is so if you do this window.log console.log log 'pancakes' Then you'll get nothing more than.. to be called with the appropriate context. However just window.log x console.log x is not quite correct as console.log is a variadic..

Chrome doesn't recognize console.log when it's called log

http://stackoverflow.com/questions/9612398/chrome-doesnt-recognize-console-log-when-its-called-log

recognize console.log when it's called log Like all programmers I'm lazy. So in my utils.js there's a simple line window.log console.log This works fine in firefox but it makes Chrome cry like a little boy. I have to write console.log to make it.. share improve this question Chrome's console.log apparently pays attention to what this is so if you do this window.log console.log log 'pancakes' Then you'll get nothing more than a TypeError Illegal invocation exception for your efforts... be lazy and just say log some console.log implementations need to be called with the appropriate context. However just window.log x console.log x is not quite correct as console.log is a variadic function. A better implementation would be this window.log..