for ... of
for...of statement rely on iterator.
During compilation, the for...of statement is expanded using an iterator.
ts
for (const value of myIterable) {
}is equivalent to
ts
for (
let it: MyIterator = myIterable[Symbol.iterator](), ret: IteratorResult<string> = it.next();
!ret.done;
ret = it.next()
) {
const value = it.value;
}