javascript Console.log 在 Chrome 中不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15745899/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Console.log not working in Chrome
提问by Cristiano
I'm trying to log some data from my javascript code to check if its right, but it doesn't seem to be working. Even when I type into the console:
我试图从我的 javascript 代码中记录一些数据以检查它是否正确,但它似乎不起作用。即使我在控制台中输入:
console.log("hello");
the console just returns undefined (which is correct) but it also doesn't log the "hello". If it matters, I'm using adblock and hoverzoom as my extensions. Also, I'm on a macbook pro. Any ideas on why this doesn't work?
控制台只返回 undefined (这是正确的),但它也不记录“hello”。如果重要的话,我使用 adblock 和 hoverzoom 作为我的扩展。另外,我使用的是 macbook pro。关于为什么这不起作用的任何想法?
回答by phihag
Most likely, you have some JavaScript in your code that overwrites console.log
for compatibility reasons (this will also affect the console of the application's tab). You can verify that by pressing F12in this taband checking that console.log
still works fine.
最有可能的是,console.log
出于兼容性原因,您的代码中有一些 JavaScript 会被覆盖(这也会影响应用程序选项卡的控制台)。您可以通过按此F12选项卡并检查是否console.log
仍然正常工作来验证这一点。