Suggestion: Array.prototype.repeat

Michael A. Smith michael at smith-li.com
Mon Jan 2 14:51:14 PST 2012


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.
> Function (not method) that returns generated array may make more sense…

Is the difference in overhead between instantiating a new array and
using Array.prototype.slice.call on arguments really worth sacrificing
consistency with the proposed string.prototype.repeat and the very
clean syntax of someArray.repeat(n)?

Michael A. Smith
Web Developer
True Action Network (an eBay company)


More information about the es-discuss mailing list