I\'m trying to make a simple loop:
const parent = this.el.parentElement
console.log(parent.children)
parent.children.forEach(child => {
console.log(chil
parent.children is not an array. It is HTMLCollection and it does not have forEach method. You can convert it to the array first. For example in ES6:
Array.from(parent.children).forEach(child => {
console.log(child)
});
or using spread operator:
[...parent.children].forEach(function (child) {
console.log(child)
});