AddEventListener for the Nodelist, how to hang up the handler on each element of the array?

It is necessary that at a clique on an element with class block, class active is removed or added, do not understand what to pass to functions? or is it all wrong?
var blocks = document.querySelectorAll('.block');

 [], function(/*What should be here?*/) {
 item.addEventListener('click', function() {
 if (item.classList.contains('active')) {
 } else {
June 8th 19 at 16:28
1 answer
June 8th 19 at 16:30
This is an arbitrary value? I item just for example added - nikita.Stracke commented on June 8th 19 at 16:33
In accordance with the documentation NodeList.forEach()in kollbek three parameters, the first of which the current node. Of course, you can call it whatever you like, including item that you already use in your code. - leanne.Robel commented on June 8th 19 at 16:36
Thank you! - nikita.Stracke commented on June 8th 19 at 16:39

Find more questions by tags JavaScript