JS iterate on child node of an object code example
Example: iterate over node object children
const secondaryNavList = document.querySelector('.navigation__secondary');
const secondaryNavListChildren = Array.from(secondaryNavList.children);
for (let secondaryNavListItem of secondaryNavListChildren) {
console.log(secondaryNavListItem);
}
const secondaryNavListChildren = Array.prototype.slice.call(secondaryNavList.children);
for (let secondaryNavListItem of secondaryNavListChildren) {
console.log(secondaryNavListItem);
}
const secondaryNavListChildren = secondaryNavList.childNodes;
secondaryNavListChildren.forEach((navListItem) => {
console.log(navListItem);
})