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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13490302/
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-26 18:56:48  来源:igfitidea点击:

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

javascript

提问by Php Php

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.

我在谷歌上搜索,但没有找到解决方案。

回答by looper

You can open the error console, depending on your browser. (Ctrl+Shift+J in Firefox, or F12 in Chrome, for example). Most browsers have the console hidden in their developer tools.

您可以打开错误控制台,具体取决于您的浏览器。(例如,Firefox 中的 Ctrl+Shift+J 或 Chrome 中的 F12)。大多数浏览器将控制台隐藏在其开发人员工具中。

回答by sohel khalifa

The console.log();statement prints anything in the browser console.

console.log();语句在浏览器控制台中打印任何内容。

Look for Developer Toolsor Simply Toolsmenu in all major browsers.

在所有主要浏览器中查找Developer Tools或简单Tools菜单。

If you are using Google Chrome the press Cntrl+shift+jto see console.

如果您使用的是 Google Chrome,请按Cntrl+shift+j查看控制台。

In Firefox, you'll need FirebugAddon to view Console

在 Firefox 中,您需要使用FirebugAddon 来查看 Console

回答by Jezen Thomas

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>

回答by Alka pandey

You can add a chrome extension named "console log viewer" and then you can see the logs even without opening the developer tool

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

回答by Vrushali Gave

For Chrome browser follow these steps:

对于 Chrome 浏览器,请按照以下步骤操作:

  1. click on More toolson the right side of the top
  2. click on Developer tools
  3. click on console
  1. 点击更多工具在顶部的右侧
  2. 点击开发者工具
  3. 点击控制台

回答by Jhonathan H.

first of all console.log()of javascript cannot be outputed in your..

首先,console.log()javascript 无法在您的..

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();

回答by arrest warrant

press F12 in google chrome and click on console to see the output

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

回答by polin

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

回答by Dennis Traub

To see the different ways to use the console in the various browsers please refer to this article:

要查看在各种浏览器中使用控制台的不同方式,请参阅这篇文章: