1.0 KiB
1.0 KiB
id | title | challengeType | videoUrl | forumTopicId |
---|---|---|---|---|
bad87fee1348bd9aedf08804 | 给 HTML 添加注释 | 0 | https://scrimba.com/p/pVMPUv/cGyGbca | 16782 |
--description--
记住:注释的开始标记是<!--
,结束标记是-->
。
现在你需要在h2
元素前终止注释。
--instructions--
任务:注释掉h1
元素和p
元素,保留h2
元素。
--hints--
注释掉h1
元素,这样它就从网页上消失了。
assert($('h1').length === 0);
h2
元素保持原样,这样网页上还能看到它。
assert($('h2').length > 0);
注释掉p
元素,这样它就从网页上消失了。
assert($('p').length === 0);
确保每一个注释都以-->
结尾。
assert(code.match(/[^fc]-->/g).length > 1);
不要更改h1
元素、h2
元素、p
元素的顺序。
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>'
);