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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 01:57:31  来源:igfitidea点击:

Console.log not working in Chrome

javascriptgoogle-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.logfor 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.logstill works fine.

最有可能的是,console.log出于兼容性原因,您的代码中有一些 JavaScript 会被覆盖(这也会影响应用程序选项卡的控制台)。您可以通过按此F12选项卡并检查是否console.log仍然正常工作来验证这一点

回答by Rm558

make sure 'Info' is checked in custom levels drop down. enter image description here

确保在自定义级别下拉列表中选中“信息”。 在此处输入图片说明