Allen Wirfs-Brock (2014-06-12T22:05:33.000Z)
domenic at domenicdenicola.com (2014-06-17T20:48:40.828Z)
Yup, there was an issue that was reported and fixed fairly recently pointing out that for-of was inconsistent with for-in in this respect. I agree that treating null/undefined as an empty collection has a smell. However, in this case my I agree with who ever it was who reported this. that consistancy between for-in and for-of is what we should have for this condition. BTW, I believe this behavior for for-in was added in ES5. My recollection was that Doug Crockford pushed for it. I don't recall if it was because it matched web reality or simply because he thought it was a good idea.