Will `for (var a of null) {}` throw an error?

Brendan Eich brendan at mozilla.org
Tue Dec 23 00:03:20 PST 2014


Oops, you're right in these cases. The CheckIterable spec helper seems
over-general. Allen?

/be

Gary Guo wrote:
> > Date: Mon, 22 Dec 2014 21:28:54 -0800
> > From: brendan at mozilla.org
> >
> > Your suggestion breaks Array.from and TypedArrayFrom.
>
> In the spec:
>
> > 8. Let arrayLike be ToObject(items).
>
> A type error will also be thrown since null and undefined are not
> ObjectCoercible.


More information about the es-discuss mailing list