Posted By

alvincrespo on 04/26/11


Tagged

javascript console detection log


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

AllKnightAccess


Console.log Detection


 / Published in: JavaScript
 

Basically creates a log function on the window object and uses console.log or alert depending on which is supported. Very basic and simple but definitely useful.

  1. window.log = function(){
  2. var output = Array.prototype.slice.call(arguments);
  3. window.console ? console.log(output) : alert(output);
  4. }

Report this snippet  

You need to login to post a comment.