That has to be the most confusing way to fill an array EVER.
On Sun, Jun 8, 2008 at 8:17 PM, tancurrom <[EMAIL PROTECTED]> wrote:
>
> It's interesting to note that in JavaScript version 1.7, array
> comprehensions allows you do achieve this kind of 'filling' of your
> arrays.
>
> E.g.
>
> function range(begin, end) {
> for (let i = begin; i < end; ++i) {
> yield i;
> }
> };
>
> var n = [0 for each (i in range(0,20))]
> // [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
>
>
> info from: http://developer.mozilla.org/en/docs/New_in_JavaScript_1.7
>
> On Jun 8, 2:44 am, Jay Tee <[EMAIL PROTECTED]> wrote:
> > On Jun 3, 10:06 am, Yanick <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > Hope this helps. (And if the core folks think this is core worthy, I
> > > think it could make a pretty addon.)
> >
> > > yanick
> >
> > You've helped very much! This particular function has helped me with
> > populating grids more than anything else. It's so much easier to fill
> > an array like this than loop or use a literal; especially for
> > particularly long arrays :)
> >
> > Jon
> >
>
--
Jerod Venema
Senior Software Engineer
Nth Penguin, LLC
http://www.nthpenguin.com
(919) 368-5105
---
WebWidgetry.com / MashupStudio.com
Future Home of the World's First Complete Web Platform
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---