Console.log Detection


/ Published in: JavaScript
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. window.log = function(){
  2. var output = Array.prototype.slice.call(arguments);
  3. window.console ? console.log(output) : alert(output);
  4. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.