Mozilla states that \"for of loops will loop over NodeList objects correctly\". (source: https://developer.mozilla.org/en-US/docs/Web/API/NodeList) However, this doesn\'t wo
You can use Array.from
let _list = document.querySelectorAll('input[type=checkbox]');
let list = Array.from(_list);
for (let item of list) {
//... just like an array
item.checked = true
}
or more shortly
let list = document.querySelectorAll('input[type=checkbox]');
for (let item of Array.from(list)) {
item.checked = true
}
Important note Array.from
was introduced in Chrome 45 source.