--- id: bad87fee1348bd9aedf08828 title: 创建一个有序列表 challengeType: 0 videoUrl: 'https://scrimba.com/p/pVMPUv/cQ3B8TM' forumTopicId: 16824 dashedName: create-an-ordered-list --- # --description-- HTML 中有用于创建有序列表的特定元素。 有序列表以 `
    ` 开始,中间包含一个或多个 `
  1. ` 元素,最后以 `
` 结束。 例如: ```html
  1. 加菲猫
  2. 哆啦A梦
``` 将会创建一个包含加菲猫和哆啦 A 梦的有序列表。 # --instructions-- 请创建一个有序列表,内容是猫咪最讨厌的三样东西(`Top 3 things cats hate:`),内容可以任意指定。 # --hints-- 应包含一个有序列表,内容是猫咪最讨厌的三样东西(`Top 3 things cats hate:`)。 ```js assert(/Top 3 things cats hate:/i.test($('ol').prev().text())); ``` 应包含有一个无序列表,内容是猫咪最喜欢的东西(`Things cats love:`)。 ```js assert(/Things cats love:/i.test($('ul').prev().text())); ``` 页面应只包含一个 `ul` 元素。 ```js assert.equal($('ul').length, 1); ``` 页面应只包含一个 `ol` 元素。 ```js assert.equal($('ol').length, 1); ``` `ul` 无序列表中应包含 3 个 `li` 元素。 ```js assert.equal($('ul li').length, 3); ``` `ol` 有序列表应该包含 3 个 `li` 元素。 ```js assert.equal($('ol li').length, 3); ``` `ul` 无序列表应有结束标签。 ```js assert( code.match(/<\/ul>/g) && code.match(/<\/ul>/g).length === code.match(/