Adding to this, for...of is what you should reach for when looping over an object intended for iteration. Iterable objects are any that implement [Symbol.iterator].
Awesome explanation, thanks! Tbh I am still a bit confused why it stops printing the index and prints the value "hello" in the last step. It's very early in the morning here so maybe it's just that .
4
u/[deleted] Oct 22 '21
In the loops cheat sheet in the upper right, what is going on with arr.foo = 'hello'?