Why is it that
for (let e in null) void e
fails gracefully, but that
for (let e of null) void e
throws a TypeError
?
Doesn't this result in an inconsistency?
for...of
only works on iterable objects (i.e. objects implementing iterable protocol) which null
is not either of these. Whereas for...in
works on all values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With