2020-10-06 23:10:08 +05:30

1.8 KiB

id, challengeType, videoUrl, forumTopicId, title
id challengeType videoUrl forumTopicId title
bad87fee1348bd9aedf08804 0 https://scrimba.com/p/pVMPUv/cGyGbca 16782 给 HTML 添加注释

Description

记住:注释的开始标记是<!--,结束标记是-->。 现在你需要在h2元素前终止注释。

Instructions

任务:注释掉h1元素和p元素,保留h2元素。

Tests

tests:
  - text: '注释掉<code>h1</code>元素,这样它就从网页上消失了。'
    testString: assert(($("h1").length === 0));
  - text: '<code>h2</code>元素保持原样,这样网页上还能看到它。'
    testString: assert(($("h2").length > 0));
  - text: '注释掉<code>p</code>元素,这样它就从网页上消失了。'
    testString: assert(($("p").length === 0));
  - text: '确保每一个注释都以<code>--&#62;</code>结尾。'
    testString: assert(code.match(/[^fc]-->/g).length > 1);
  - text: '不要更改<code>h1</code>元素、<code>h2</code> 元素、<code>p</code>元素的顺序。'
    testString: assert((code.match(/<([a-z0-9]){1,2}>/g)[0]==="<h1>" && code.match(/<([a-z0-9]){1,2}>/g)[1]==="<h2>" && code.match(/<([a-z0-9]){1,2}>/g)[2]==="<p>") );

Challenge Seed

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

<h2>CatPhotoApp</h2>

<p>在大家心目中,猫是慵懒和可爱的化身,它可以睡饱了再起来吃饭,可以逗趣小耗子,可以卖得了萌,使得了坏,这样百变的小怪兽就集结在一只宠物上,怎能不惹人怜爱。</p>
-->

Solution