Re:Firebug lead developer now working on Web dev tools at Go...
by jdunck on Sunday July 17, 2011 @11:39PM
(#2775026)
window.console.log.apply(window.console, arguments)
[ Parent
| on HN ]
Re:Firebug lead developer now working on Web dev tools at Go...
by Inviz on Sunday July 17, 2011 @11:44PM
(#2775033)
See? There's the problem. Since there's no conclusion between vendors on console object API, console.log function may not have .apply method.
It's not only the console object functions actually, most of the browsers choke on a [1,2,3].forEach(alert) and other [Native Code] functions.
Re:Firebug lead developer now working on Web dev tools at Go...
by gonchuki on Wednesday July 20, 2011 @03:33PM
(#2787083)
Function.prototype.apply.apply(console.log, [console, arguments]);
Works both on IE9 broken console.log, and regular console.log from other vendors. Same hack as using Array.prototype.slice to convert arguments into a real array.