JavaScript Tip: Working with querySelectorAll Results

preview_player
Показать описание
Converting the results of querySelectorAll to an array allows you to use the array methods to work with those DOM elements. We show you how to do the conversion and discuss why it works. We then work with the results use forEach.
For a complete list of all our tutorials:

Take the Learn Modern JavaScript: Getting Started course at a huge discount:
Take the Learn Modern JavaScript: Advanced Topics course at a huge discount:

Рекомендации по теме
Комментарии
Автор

exactly what i was looking for right now. thanks man !

tusharghildiyal
Автор

Great tutorials ... thanks for sharing ...
BTW i have one question .. what would be the difference if we used the Array.from() method ? ...

ManontheBroadcast
Автор

I'm using simpler way to convert node list to Array and result is the same.

const li =
const li_array = Array.from(li);

PrzyjacielKamil
Автор

is the 'new Array(...nodelist)' technique better or worse that using slice() ?

clumsycoco