Skip to content

Commit

Permalink
browser: use typeof to check for console existence
Browse files Browse the repository at this point in the history
It's a global, so we must check with typeof otherwise
an error will be thrown if `console` is undefined.
  • Loading branch information
TooTallNate committed Dec 29, 2014
1 parent 4fd6f39 commit df3e0ea
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ function formatArgs() {
*/

function log() {
// This hackery is required for IE8,
// where the `console.log` function doesn't have 'apply'
return console
// this hackery is required for IE8/9, where
// the `console.log` function doesn't have 'apply'
return 'object' === typeof console
&& console.log
&& Function.prototype.apply.call(console.log, console, arguments);
}
Expand Down

0 comments on commit df3e0ea

Please sign in to comment.