---
id: bad87fee1348bd9aedf08802
challengeType: 0
videoUrl: 'https://scrimba.com/p/pVMPUv/cBmG9T7'
forumTopicId: 18329
title: 去除 HTML 的注释
---
## Description
注释的作用是给代码添加一些说明,方便团队合作或日后自己查看,但又不影响代码本身。
注释的另一个用途就是在不删除代码的前提下,让代码不起作用。
在 HTML 中,注释的开始标记是<!--
,结束标记是-->
。
## Instructions
现在我们反其道而行之,去掉h1
元素、h2
元素、p
元素的注释。
## Tests
```yml
tests:
- text: '确保网页中能看到h1
元素。'
testString: assert($("h1").length > 0);
- text: '确保网页中能看到h2
元素。'
testString: assert($("h2").length > 0);
- text: '确保网页中能看到p
元素。'
testString: assert($("p").length > 0);
- text: '确保删除了注释的结束标记-->
。'
testString: assert(!$('*:contains("-->")')[1]);
```
## Challenge Seed
## Solution