The Daily Shaarli

All links of one day in a single page.

07/20/21

Looping over Arrays: `for` vs. `for-in` vs. `.forEach()` vs. `for-of`

As we have seen, the for-of loop beats for, for-in, and .forEach() w.r.t. usability.

Any difference in performance between the four looping mechanisms should normally not matter. If it does, you are probably doing something very computationally intensive and switching to WebAssembly may make sense.

"Images are hard", Chris Coyier (@chriscoyier)
thumbnail

Putting images on websites is incredibly simple, yes? Actually, yes, it is. You use <img> and link it to a valid source in the src attribute and you’re done. Except that there are (counts fingers) 927 things you could (and some you really should) do that often go overlooked. Let’s see…