--- id: 587d7b83367417b2b2512b33 title: Use the JavaScript Console to Check the Value of a Variable challengeType: 1 videoUrl: '' localeTitle: 使用JavaScript控制台检查变量的值 --- ## Description
Chrome和Firefox都有出色的JavaScript控制台,也称为DevTools,用于调试JavaScript。您可以在Chrome的菜单或FireFox菜单中的Web控制台中找到开发人员工具。如果您使用的是其他浏览器或手机,我们强烈建议您使用桌面版Firefox或Chrome。 console.log()方法将打印其括号内的输出“打印”到控制台,这可能是最有用的调试工具。将它放在代码中的关键点可以显示变量的中间值。在查看输出之前,最好先了解输出应该是什么。在整个代码中使用检查点来查看计算状态将有助于缩小问题所在。这是打印'Hello world!'的示例到控制台: console.log('Hello world!');
## Instructions
使用console.log()方法打印代码中记录的变量a的值。
## Tests
```yml tests: - text: 您的代码应使用console.log()来检查变量a的值。 testString: 'assert(code.match(/console\.log\(a\)/g), "Your code should use console.log() to check the value of the variable a.");' ```
## Challenge Seed
```js let a = 5; let b = 1; a++; // Add your code below this line let sumAB = a + b; console.log(sumAB); ```
## Solution
```js // solution required ```