for own(...) loop (spin-off from Re:, hasOwnProperty(), and inheritance)

Felipe Gasper felipe at
Tue Nov 8 13:00:19 PST 2011

On 11/8/11 2:49 PM, Brendan Eich wrote:
> Should 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.

This is a fantastic idea, IMO.

The hasOwnProperty() thing is buggy if you create a “hasOwnProperty” 
property on the object, and it’s wordy besides.


More information about the es-discuss mailing list