In JavaScript, we can use methods such as getElementsByClassName to select multiple elements.
getElementsByClassName will select all matching elements and return back a HTMLCollection.
A HTMLCollection is an array-like generic group of elements, not an actual array. This means we can not use array methods such as map, forEach etc.
To get around this, the HTMLCollection can be converted to an array using the Javascript Array object. And I will show you how to do this in this short video.
------------------------------------------------------------------------
Looking for a complete guide to JavaScript?
You can find my comprehensive course here with 50% off:
chrisdixon.gum...
------------------------------------------------------------------------
You can also find a text-based version of this video here:
chrisdixon.dev...
Check my site for more content:
chrisdixon.dev/
------------------------------------------------------------------------
Негізгі бет Convert a HTMLCollection To a JavaScript Array
Пікірлер: 8