简体   繁体   English

"如何查看 console.log() 的输出?"

[英]How can I see the output of console.log()?

I am using this code:我正在使用这段代码:

<script type = "text/javascript">
 console.log("hello world");
</script>

How can I see the output of console.log() ?如何查看console.log()的输出?

I searched on Google but did not find a solution.我在谷歌上搜索但没有找到解决方案。

You can open the error console, depending on your browser.您可以打开错误控制台,具体取决于您的浏览器。 (Ctrl+Shift+J in Firefox, or F12 in Chrome, for example). (例如,Firefox 中的 Ctrl+Shift+J 或 Chrome 中的 F12)。 Most browsers have the console hidden in their developer tools.大多数浏览器的控制台都隐藏在其开发人员工具中。

The console.log(); console.log(); statement prints anything in the browser console.语句在浏览器控制台中打印任何内容。

Look for Developer Tools or Simply Tools menu in all major browsers.在所有主要浏览器中查找Developer Tools或简单Tools菜单。

If you are using Google Chrome the press Cntrl+shift+j to see console.如果您使用的是 Google Chrome,请按Cntrl+shift+j以查看控制台。

In Firefox, press Ctrl+Shift+I and click on Console to view the console on Firefox.在 Firefox 中,按Ctrl+Shift+I并单击 Console 以在 Firefox 上查看控制台。

You need to view the result in the console.您需要在控制台中查看结果。 Open the console.打开控制台。

Also, you have a problem with your code.此外,您的代码有问题。

<script type = "text/javascript">
console.log("hello world");
</script>

Is not valid.无效。 Remove the spaces in the script tag, like this:删除脚本标签中的空格,如下所示:

<script type="text/javascript">
console.log("hello world");
</script>

在谷歌浏览器中按 F12 并单击控制台以查看输出

  1. Open firefox打开火狐
  2. Go to tools and then add-on.转到工具,然后添加。
  3. Search and install an add-on named "firebug"搜索并安装名为“firebug”的附加组件
  4. before reloading your page open firebug and go to console tab.在重新加载页面之前打开 firebug 并转到控制台选项卡。
    You will see your desired result.你会看到你想要的结果。 If you have chrome then its already there.如果你有 chrome 那么它已经在那里了。 just use it就用它

To see the different ways to use the console in the various browsers please refer to this article:要查看在各种浏览器中使用控制台的不同方式,请参阅这篇文章:

first of all console.log() of javascript cannot be outputed in your..首先,javascript 的console.log()无法在您的..

you need the javascript console to output it你需要 javascript 控制台来输出它

first第一的

press F12 then click the console label按 F12 然后单击控制台标签

before refreshing the browser to see your output..在刷新浏览器以查看您的输出之前..

but if your console.log() alternatives for browser is document.write();但是如果你的浏览器的console.log()替代品是document.write();

您可以添加名为“控制台日志查看器”的 chrome 扩展,然后即使不打开开发人员工具也可以查看日志

For Chrome browser follow these steps:对于 Chrome 浏览器,请按照以下步骤操作:

  1. click on More tools on the right side of the top点击右上角的更多工具
  2. click on Developer tools点击开发者工具
  3. click on console点击控制台
<script>
function imadumbperson() {
var me document.getelementbyid('demo');
console.log(me);
}
<script>

if only console can have id and a new variable called selfMessage();如果只有控制台可以有id和一个名为selfMessage(); so we can do the same:所以我们也可以这样做:

<script>
function imadumbperson() {
var me document.getelementbyid('demo');
console.log(me); { id='console' }
var me2 document.getelementbyid('console');
selfmessage(me2)
}
<script>

so if this happend then the console will keep it and then the message will come to us.因此,如果发生这种情况,那么控制台将保留它,然后消息将发送给我们。 the best way最好的方法

due to mathimathics, the console.log(say);<\/code>由于数学, console.log(say);<\/code> is not detectable.检测不到。 but it can say what the input it was to the user但它可以说出它对用户的输入

<input id='demo'/>
<script>
var myDomain = document.getElementById("demo").innerHTML = 'hello,' + myDomain;
</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM