> For the complete documentation index, see [llms.txt](https://westsilver.gitbook.io/study-script/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://westsilver.gitbook.io/study-script/javascript/web-browser/untitled/htmlcollection.md).

# HTMLCollection

* [HTMLCollection](http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-75708506)\
  : HTMLCollection은 리턴 결과가 **복수**인 경우에 사용하게 되는 객체다. \
  유사배열로 배열과 비슷한 사용방법을 가지고 있지만 배열은 아니다.

&#x20;

<figure><img src="/files/d5OTBVU1Ukja3Kq9lLU7" alt=""><figcaption></figcaption></figure>

```html
<!DOCTYPE html>
<html>
<body>
<ul>
    <li>HTML</li>
    <li>CSS</li>
    <li id="active">JavaScript</li>
</ul>
<script>
console.group('before');
let lis = document.getElementsByTagName('li');
for(let i = 0; i < lis.length; i++){
    console.log(lis[i]);
}
console.groupEnd();
console.group('after');
lis[1].parentNode.removeChild(lis[1]);
for(let i = 0; i < lis.length; i++){
    console.log(lis[i]);
}
console.groupEnd();
</script>
</body>
</html>
```
