Suggestion: Array.prototype.repeat

Greg Smith greg at bocoup.com
Tue Jan 3 06:46:55 PST 2012


What is the use case for .repeat? Trying to imagine some code where I'd
need it so I can get a feel for how it should work.

On Tue, Jan 3, 2012 at 9:19 AM, Mariusz Nowak <
medikoo+mozilla.org at medikoo.com> wrote:

>
>
> Rick Waldron wrote:
> >
> > On Tue, Jan 3, 2012 at 3:34 AM, Mariusz Nowak <
> > medikoo+mozilla.org at medikoo.com> wrote:
> >
> >>
> >>
> >> Rick Waldron wrote:
> >> >
> >> > On Mon, Jan 2, 2012 at 3:56 PM, Mariusz Nowak <
> >> > medikoo+mozilla.org at medikoo.com> wrote:
> >> >
> >> >>
> >> >> I like it, it indeed looks very logical, however it's a bit
> >> controversial
> >> >> that we need to create temporary array object to get one that we
> want.
> >> >>
> >> >
> >> > Is the controversy editorial or fact, because the following methods
> are
> >> > all
> >> > specified to use a temporary, newly initialized Array internally:
> >> >
> >> > Array.prototype.concat
> >> > Array.prototype.filter (...)
> >> >
> >>
> >> Rick, you say that apart of output arrays this methods create some other
> >> temporary arrays internally ?
> >> I don't see anything like that in specification, where exactly is it
> >> stated
> >> ?
> >>
> >
> >
> > Array.prototype.concat
> >  - http://es5.github.com/#x15.4.4.4 #2
> >
> > Array.prototype.filter
> >  - http://es5.github.com/#x15.4.4.20 #6
> >
> > (...)
> >
>
> Rick, those arrays become result of each method, they're not temporary.
>
>
> -----
> Mariusz Nowak
>
> https://github.com/medikoo
> --
> View this message in context:
> http://old.nabble.com/Suggestion%3A-Array.prototype.repeat-tp33067649p33072157.html
> Sent from the Mozilla - ECMAScript 4 discussion mailing list archive at
> Nabble.com.
>
> _______________________________________________
> 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/20120103/1c7570d4/attachment-0001.html>


More information about the es-discuss mailing list