1.5 KiB
1.5 KiB
id, title, challengeType, videoUrl, forumTopicId, localeTitle
id | title | challengeType | videoUrl | forumTopicId | localeTitle |
---|---|---|---|---|---|
bd7123c9c441eddfaeb4bdef | Comment Your JavaScript Code | 1 | https://scrimba.com/c/c7ynnTp | 16783 | 给代码添加注释 |
Description
//
注释掉当前行的代码
// This is an in-line comment.
你也可以使用多行注释来注释你的代码,以/
开始,用/
来结束,就像下面这样:
/* This is a
multi-line comment */
最佳实践
写代码的时候,要定期添加注释对部分代码块进行解释。适当的注释能让别人和你自己更容易看懂代码。
Instructions
Tests
tests:
- text: 创建一个<code>//</code>样式的注释, 被注释的文本至少要包含 5 个字符。
testString: assert(code.match(/(\/\/)...../g));
- text: 创建一个<code>/* */</code>样式的注释, 被注释的文本至少要包含 5 个字符。
testString: assert(code.match(/(\/\*)([^\/]{5,})(?=\*\/)/gm));
Challenge Seed
Solution
// Fake Comment
/* Another Comment */