The recommended practice when writing for-in loops in JS today is to write:

  for (i in o) {
    if (o.hasOwnProperty(i)) {
      body
    }
  }

Although many JS developers do not follow the recommendation (out of ignorance 
or intentionally, doesn't matter).

Should ES.next provide sugar for the recommended pattern? To make it compose 
with declarations and destructuring in the for head, it should use a contextual 
keyword immediately after 'for':

  for own (i in o) {
    body
  }

This is a small thing but it might pay off in the long run.

/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to