freeCodeCamp/guide/chinese/javascript/tutorials/use-the-javascript-console/index.md

20 lines
640 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: Use the JavaScript Console
localeTitle: 使用JavaScript控制台
---
Chrome和Firefox都有出色的JavaScript控制台也称为DevTools用于调试JavaScript。
您可以在Chrome的菜单或FireFox菜单中的Web控制台中找到开发人员工具。如果您使用的是其他浏览器或手机我们强烈建议您使用桌面版Firefox或Chrome。
您还可以使用[https://repl.it/](https://repl.it/)在线运行代码。
这是您打印到控制台的方式:
```
console.log('Hello world!')
```
您还可以使用以下代码在控制台中打印错误日志:
```
console.error('I am an error!')
```