Posted By

alvincrespo on 04/26/11


javascript console detection log

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


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 =;
  3. window.console ? console.log(output) : alert(output);
  4. }

Report this snippet  

You need to login to post a comment.