1.7 KiB
1.7 KiB
id, title, challengeType, videoUrl, localeTitle
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
587d7b83367417b2b2512b33 | Use the JavaScript Console to Check the Value of a Variable | 1 | 使用JavaScript控制台检查变量的值 |
Description
console.log()
方法将打印其括号内的输出“打印”到控制台,这可能是最有用的调试工具。将它放在代码中的关键点可以显示变量的中间值。在查看输出之前,最好先了解输出应该是什么。在整个代码中使用检查点来查看计算状态将有助于缩小问题所在。这是打印'Hello world!'的示例到控制台: console.log('Hello world!');
Instructions
console.log()
方法打印代码中记录的变量a
的值。 Tests
tests:
- text: 您的代码应使用<code>console.log()</code>来检查变量<code>a</code>的值。
testString: 'assert(code.match(/console\.log\(a\)/g), "Your code should use <code>console.log()</code> to check the value of the variable <code>a</code>.");'
Challenge Seed
let a = 5;
let b = 1;
a++;
// Add your code below this line
let sumAB = a + b;
console.log(sumAB);
Solution
// solution required