forEach is not a function error with JavaScript array
First option: invoke forEach indirectly The parent.children is an Array like object. Use the following solution: const parent = this.el.parentElement; Array.prototype.forEach.call(parent.children, child => { console.log(child) }); The parent.children is NodeList type, which is an Array like object because: It contains the length property, which indicates the number of nodes Each node is a property value … Read more