I have a collection of paragraph elements. Some are empty and some contain whitespace only, while others have content:
Pellentesque habitant morbi t
The length of your HTMLCollection changes when you remove an item. A way to do it is to use a while loop
while(paragraphs.length > 0) { paragraphs[0].remove(); }