小编典典

IE8 中的 console.log 发生了什么?

all

根据这篇文章,它是在测试版中,但它不在版本中?


阅读 185

收藏
2022-05-19

共1个答案

小编典典

更好的后备是这样的:

   var alertFallback = true;
   if (typeof console === "undefined" || typeof console.log === "undefined") {
     console = {};
     if (alertFallback) {
         console.log = function(msg) {
              alert(msg);
         };
     } else {
         console.log = function() {};
     }
   }
2022-05-19