In the MDN docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of
The for...of
construct is described to be able to iterate over "iterable" objects. But is there a good way of deciding whether an object is iterable?
I've tried to find common properties for arrays, iterators and generators, but have been unable to do so.
Aside from doing a for ... of
in a try block and checking for type errors, is there a clean way of doing this?