andrew4582

Safe console 2

May 19th, 2014
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (typeof console === 'undefined') {
  2.     var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
  3.     "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
  4.  
  5.     console = {};
  6.     for (var i = 0; i < names.length; ++i)
  7.         console[names[i]] = function () { }
  8. }
Advertisement
Add Comment
Please, Sign In to add comment