--- id: bad87fee1348bd9aedf08828 title: 創建一個有序列表 challengeType: 0 videoUrl: 'https://scrimba.com/p/pVMPUv/cQ3B8TM' forumTopicId: 16824 dashedName: create-an-ordered-list --- # --description-- HTML 中有用於創建有序列表的特定元素。 有序列表以 `
    ` 開始,中間包含一個或多個 `
  1. ` 元素。 最後以 `
` 結束。 例如: ```html
  1. Garfield
  2. Sylvester
``` 將創建一個包含 `Garfield` 和 `Sylvester` 的編號列表。 # --instructions-- 請創建一個有序列表,內容是貓咪最討厭的三樣東西。 # --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(/