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

Dean Landolt dean at deanlandolt.com
Wed Nov 9 13:03:27 PST 2011


On Wed, Nov 9, 2011 at 3:40 PM, Jorge <jorge at jorgechamorro.com> wrote:

> On 08/11/2011, at 22:17, John J Barton wrote:
> > Just as a point of comparison, I use this form:
> >   Object.keys(o).forEach( function(key) {
> >      body
> >   });
>
> By the way, isn't that above a(nother) good use case for a goto, given
> that there's no (easy) way to break out of a forEach 'loop' ?
>

A goto? *Really*? Array.prototype.some is a good way to get forEach-like
behavior where you can break out of.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111109/58a8f8ec/attachment.html>


More information about the es-discuss mailing list