for-of is a new loop in ES6 that replaces both
forEach() and supports the new iteration protocol.
Iterating over an Array
Iterating over a String
for...in loop will iterate over all enumerable properties of an object.
for...of syntax is specific to collections, rather than all objects.
The following example shows the difference between a
for...of loop and a