For...in or For...of
I can never remember which is which when it comes to
One iterates over values and one over properties. But which is which? Lucky you, future me, you’ll find out if you keep reading.
The for…in statement iterates over the enumerable properties of an object, in an arbitrary order.
The for…of statement iterates over values that the iterable object defines to be iterated over.
Thank you, MDN (always).
- in for properties
- of for values
Other looping methods
You might want
See MDN for a few other looping approaches that you might not want.