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