So if you're answer is not then why we can use array foreach method with node list
And with html collection we can't use foreach method however html collection is also not an array
Thanks
So if you're answer is not then why we can use array foreach method with node list
And with html collection we can't use foreach method however html collection is also not an array
Thanks
No, NodeList is not an array.
Any object may have a forEach method. NodeList is such an object: NodeList.prototype.forEach().
HtmlCollection does not implement forEach, so you cannot use forEach on it.
