"for ... of" and "for ... in"
Know that they are different beasts.
You cannot use for ... of
and for ... in
interchangeably in JavaScript.
for ... of
statements are for iterable objects. So, you can iterate over arrays, strings, maps, and sets with a for ... of
statement.
On the other hand, for ... in
statements are for enumerable properties of an object. Enumerable properties are properties whose internal flag is set to true by default.