Remove Child Elements From An HTML Element With JavaScript

TL;DR

This is what worked for me to remove child nodes from an element to clear it out:

Code
const alfa = document.getElementById('someElement')

while (alfa.children.length > 0) {
    alfa.children[0].remove()
}

Where _alfa__ is the element to remove the children from

What Didn't Work

The MDN docs say to do this, but it didn't work for me. It wouldn't clear all the elements.

Code
for (const child of playlists_div.children) {
    child.remove()
}

Not sure why.

(Thanks to i7 from Twitch chat for giving me the solution and saying me a non trivial amount of time)

Reference

MDN Element children documentation

This is where I got the code that didn't work. Need to go back and figure out where the problem resides