* feat(tools): add seed/solution restore script * chore(curriculum): remove empty sections' markers * chore(curriculum): add seed + solution to Chinese * chore: remove old formatter * fix: update getChallenges parse translated challenges separately, without reference to the source * chore(curriculum): add dashedName to English * chore(curriculum): add dashedName to Chinese * refactor: remove unused challenge property 'name' * fix: relax dashedName requirement * fix: stray tag Remove stray `pre` tag from challenge file. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
1.3 KiB
1.3 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
bd7123c9c441eddfaeb4bdef | 给代码添加注释 | 1 | https://scrimba.com/c/c7ynnTp | 16783 | comment-your-javascript-code |
--description--
被注释的代码块在 JavaScript 之中是不会执行的。在代码中写注释是一个非常好的方式让你自己和其他人理解代码。
JavaScript 中的注释方式有以下两种:
使用//
注释掉当前行的代码
// This is an in-line comment.
你也可以使用多行注释来注释你的代码,以/
开始,用``/
来结束,就像下面这样:
/* This is a
multi-line comment */
最佳实践
写代码的时候,要定期添加注释对部分代码块进行解释。适当的注释能让别人和你自己更容易看懂代码。
--instructions--
尝试创建这两种类型的注释。
--hints--
创建一个//
样式的注释, 被注释的文本至少要包含 5 个字符。
assert(code.match(/(\/\/)...../g));
创建一个/* */
样式的注释, 被注释的文本至少要包含 5 个字符。
assert(code.match(/(\/\*)([^\/]{5,})(?=\*\/)/gm));
--seed--
--seed-contents--
--solutions--
// Fake Comment
/* Another Comment */