Back to Freecodecamp

Uncomment HTML

curriculum/challenges/english/blocks/basic-html-and-html5/bad87fee1348bd9aedf08802.md

latest1.5 KB
Original Source

--description--

Commenting is a way that you can leave comments for other developers within your code without affecting the resulting output that is displayed to the end user.

Commenting is also a convenient way to make code inactive without having to delete it entirely.

Comments in HTML start with <!-- and end with a -->

--instructions--

Uncomment your h1, h2 and p elements.

--hints--

Your h1 element should be visible on the page by uncommenting it.

js
assert.notEmpty(document.querySelectorAll('h1'));

Your h2 element should be visible on the page by uncommenting it.

js
assert.notEmpty(document.querySelectorAll('h2'));

Your p element should be visible on the page by uncommenting it.

js
assert.notEmpty(document.querySelectorAll('p'));

No trailing comment tags should be visible on the page (i.e. -->).

js
const elements = document.querySelectorAll('*');
const potentialComments = Array.from(elements).filter(el => el.textContent.includes('-->'));
assert.notExists(potentialComments[1])

--seed--

--seed-contents--

html
<!--
<h1>Hello World</h1>

<h2>CatPhotoApp</h2>

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
-->

--solutions--

html
<h1>Hello World</h1>

<h2>CatPhotoApp</h2>

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>