In order to get the matched elements & loop over it , I am using querySelectorAll
& forEach
array method. According to this,querySelectorAll
will return a nodelist
.
I can also use getElementsByClassName
by get the matched elements but cannot directly use forEach
. But this link tell us that it also return an nodelist object
on using forEach
on return of getElementsByClassName
it throws an error ,forEach is not a function
Can you please let me know why forEach
does not directly work on return of getElementsByClassName
, when return of both getElementsByClassName
& querySelectorAll
is nodelist