* 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>
99 lines
2.8 KiB
Markdown
99 lines
2.8 KiB
Markdown
---
|
|
id: bad87fee1348bd9aec908857
|
|
title: Use Comments to Clarify Code
|
|
challengeType: 0
|
|
forumTopicId: 18347
|
|
dashedName: use-comments-to-clarify-code
|
|
---
|
|
|
|
# --description--
|
|
|
|
When we start using jQuery, we will modify HTML elements without needing to actually change them in HTML.
|
|
|
|
Let's make sure that everyone knows they shouldn't actually modify any of this code directly.
|
|
|
|
Remember that you can start a comment with `<!--` and end a comment with `-->`
|
|
|
|
Add a comment at the top of your HTML that says `Code below this line should not be changed`
|
|
|
|
# --hints--
|
|
|
|
You should start a comment with `<!--` at the top of your HTML.
|
|
|
|
```js
|
|
assert(code.match(/^\s*<!--/));
|
|
```
|
|
|
|
Your comment should have the text `Code below this line should not be changed`.
|
|
|
|
```js
|
|
assert(code.match(/<!--(?!(>|->|.*-->.*this line))\s*.*this line.*\s*-->/gi));
|
|
```
|
|
|
|
You should close your comment with `-->`.
|
|
|
|
```js
|
|
assert(code.match(/-->.*\n+.+/g));
|
|
```
|
|
|
|
You should have the same number of comment openers and closers.
|
|
|
|
```js
|
|
assert(code.match(/<!--/g).length === code.match(/-->/g).length);
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```html
|
|
<div class="container-fluid">
|
|
<h3 class="text-primary text-center">jQuery Playground</h3>
|
|
<div class="row">
|
|
<div class="col-xs-6">
|
|
<h4>#left-well</h4>
|
|
<div class="well" id="left-well">
|
|
<button class="btn btn-default target" id="target1">#target1</button>
|
|
<button class="btn btn-default target" id="target2">#target2</button>
|
|
<button class="btn btn-default target" id="target3">#target3</button>
|
|
</div>
|
|
</div>
|
|
<div class="col-xs-6">
|
|
<h4>#right-well</h4>
|
|
<div class="well" id="right-well">
|
|
<button class="btn btn-default target" id="target4">#target4</button>
|
|
<button class="btn btn-default target" id="target5">#target5</button>
|
|
<button class="btn btn-default target" id="target6">#target6</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```html
|
|
<!-- Code below this line should not be changed -->
|
|
<div class="container-fluid">
|
|
<h3 class="text-primary text-center">jQuery Playground</h3>
|
|
<div class="row">
|
|
<div class="col-xs-6">
|
|
<h4>#left-well</h4>
|
|
<div class="well" id="left-well">
|
|
<button class="btn btn-default target" id="target1">#target1</button>
|
|
<button class="btn btn-default target" id="target2">#target2</button>
|
|
<button class="btn btn-default target" id="target3">#target3</button>
|
|
</div>
|
|
</div>
|
|
<div class="col-xs-6">
|
|
<h4>#right-well</h4>
|
|
<div class="well" id="right-well">
|
|
<button class="btn btn-default target" id="target4">#target4</button>
|
|
<button class="btn btn-default target" id="target5">#target5</button>
|
|
<button class="btn btn-default target" id="target6">#target6</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
```
|