1.4 KiB
Raw Blame History

id, title, challengeType, videoUrl, forumTopicId
id title challengeType videoUrl forumTopicId
bad87fee1348bd9aedf08827 创建一个无序列表 0 https://scrimba.com/p/pVMPUv/cDKVPuv 16814

--description--

HTML 有一个特定的元素用于创建无序列表unordered lists缩写 ul

无序列表以<ul>开始,中间包含一个或多个<li>元素,最后以</ul>结尾。

例如:

<ul>
  <li>牛奶</li>
  <li>奶酪</li>
</ul>

将会创建一个包含牛奶和奶酪的无序列表。

--instructions--

删除页面底部的两个p元素,然后在底部创建一个无序列表,其中包含你认为猫咪最喜欢的三件东西。

--hints--

创建一个ul无序列表。

assert($('ul').length > 0);

你应该在ul无序列表中添加三个li条目。

assert($('ul li').length > 2);

确保ul无序列表有结束标记。

assert(
  code.match(/<\/ul>/gi) &&
    code.match(/<ul/gi) &&
    code.match(/<\/ul>/gi).length === code.match(/<ul/gi).length
);

确保每个li条目都有结束标记。

assert(
  code.match(/<\/li>/gi) &&
    code.match(/<li[\s>]/gi) &&
    code.match(/<\/li>/gi).length === code.match(/<li[\s>]/gi).length
);

每个li元素都应该有一个空字符串或者空格。

assert($('ul li').filter((_, item) => !$(item).text().trim()).length === 0);

--solutions--