Get a list of the Element’s immediate child elements, optionally filtered by a callback function.
.getChildren(callback = undefined)A simple example could look like this:
document.getElementById('foo') .getChildren() .forEach( (item) => { … });
By using a filtering function, e.g. to only collect descendants which are <a> elements:
let list = document.getElementById('foo') .getChildren( e => e.nodeName == 'A' );
.nodeName property always contains the element name in uppercase letters!