From https://plus.google.com/+IanBicking/posts/PbXDtNF9Gg6:
"""
Ian Bicking
Shared publicly - Mar 24, 2015
#Array
Huh, "for (attr in obj)" goes along with "if (attr in obj)", but "for
(item of array)" doesn't have an equivalent "if (item of array)"
There is a proposal I guess for a method, but only for ES7:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
"""
It's obvious in hindsight. Wants a @@hasInstance-like protocol, not just
desugaring to `includes` with operands transposed to receiver and argument.
An `of` operator with unstratified symbol-named MOP hook helps various
container-like objects cope with the vagaries of NaNs and indexOf /
includes differences between arrays and strings, and (most winningly)
lines up with for-of, as Ian points out, in a parallel to for-in and `in`.
I'm sure it's worth some debate, perhaps someone will k.o. the idea with
an objection I can't think of, but I like it.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss