Test name | Executions per second |
---|---|
[].forEach.call | 1980651.5 Ops/sec |
for...of | 1912658.8 Ops/sec |
<p id="p">hello</p>
let p = document.getElementById('p')
for(let i = 300; i--;) p.appendChild(document.createElement('p'))
function myFunc(node) {
node.remove()
}
[].forEach.call(p.querySelectorAll('*'), myFunc)
for(let node of p.querySelectorAll('*'))node.remove()