3 ms·
And it's especially bad if you interleave them all: var heights = lotsOfElements.map(function(el){ el.classList.add('ok'); return el.clientHeight;
by jffry 11y ago
And it's especially bad if you interleave them all:
var heights = lotsOfElements.map(function(el){
el.classList.add('ok');
return el.clientHeight;
});
Better is to batch the DOM updates and reads, where you can:
lotsOfElements.forEach(function(el){
el.classList.add('ok');
});
var heights = lotsOfElements.map(function(el){
return el.clientHeight;
});