Why is this
for (let e in null) void e
gracefully crashes but
for (let e of null) void e
throws a TypeError ? Does this lead to inconsistency?
TypeError
for...of only works with iterable objects (i.e. objects that implement the iterative protocol ), which null is not one of them. While for...in works with all values.
for...of
null
for...in