For-has-in loop

Peter Jaszkowiak p.jaszkow at gmail.com
Mon Feb 19 18:57:59 UTC 2018


You could use Object.keys, Object.entries, or Object.values on the right
side of `of` instead.

On Feb 19, 2018 11:50, "Sebastian Malton" <sebastian at malton.name> wrote:

> I would like to propose that the following be valid since it is a very
> common use case.
>
> ```
> for (const field has in object) {
>     ....
> }
> ```
>
> Would be equivalent to:
>
> ```
> for (const field in object) {
>     if (!object.hasOwnPropety(field)) {
>         continue;
>     }
>     ....
> }
> ```
>
> Sebastian Malton
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180219/aac2061e/attachment.html>


More information about the es-discuss mailing list