Spread operator is not needed for the iterable in for...of
ianthedev opened this issue · comments
The proposed vanilla version of remove is using the spread operator on the iterable in for...of:
el.remove();
// multiple elements
for (const el of [...document.querySelectorAll(selector)]) {
el.remove();
}
The spread operator is actually not needed. The for...of loop can be simplified as:
for (const el of document.querySelectorAll(selector)) {
el.remove();
}