Back to Freecodecamp

Step 4

curriculum/challenges/english/blocks/workshop-cat-photo-app/5dc17dc8f86c76b9248c6eb5.md

latest1.6 KB
Original Source

--description--

Commenting allows you to leave messages without affecting the browser display. It also allows you to make code inactive. A comment in HTML starts with <!--, contains any number of lines of text, and ends with -->.

Here is an example of a comment with the TODO: Remove h1:

html
<!-- TODO: Remove h1 -->

Add a comment above the p element with this text:

TODO: Add link to cat photos

--hints--

Your comment should start with <!--. You are missing one or more of the characters that define the start of a comment.

js
assert.match(code, /<!--/);

Your comment should end with -->. You are missing one or more of the characters that define the end of a comment.

js
assert.match(code, /-->/);

Your code should not have extra opening/closing comment characters. You have an extra <!-- or --> displaying in the browser.

js
const noSpaces = code.replace(/\s/g, '');
assert.isBelow(noSpaces.match(/<!--/g)?.length, 2)
assert.isBelow(noSpaces.match(/-->/g)?.length, 2);

Your comment should be above the p element. You have them in the wrong order.

js
assert.match(
  code.replace(/\s/g, ''),
  /<!--(.*?)--><p>everyonelovescutecatsonline!<\/p>/i
);

Your comment should contain the text TODO: Add link to cat photos.

js
assert.match(code, /<!--\s*todo:\s+add\s+link\s+to\s+cat\s+photos\s*-->/i);

--seed--

--seed-contents--

html
<html>
  <body>
    <h1>CatPhotoApp</h1>
    <h2>Cat Photos</h2>
--fcc-editable-region--
    
--fcc-editable-region--
    <p>Everyone loves cute cats online!</p>
  </body>
</html>