forgot squared brckets ...

 myCallback.apply(nulll, [element, count, array].concat(this));

On Mon, Dec 22, 2014 at 1:29 PM, Andrea Giammarchi <
[email protected]> wrote:

> if you don't need a context, you can simply use it to pass anything you
> want.
>
> as example, instead of this
>
> On Sat, Dec 20, 2014 at 12:12 PM, Christian Mayer <[email protected]>
> wrote:
>>
>>
>> [1,2,3].forEach( myCallback, undefined, 'additionalFoo' );
>>
>>
> you could do this:
>
> [1,2,3].forEach( callback, ['additionalFoo']);
>
> and callback will look like
>
> function callback( element, count, array )
> {
>   myCallback.apply(nulll, element, count, array.concat(this));
> }
>
> In this way you can prepend, append, swap index, use just what you need
> ... etc ... I don't think it can be simplified any better with yet another
> change to the Array API
>
> Best Regards
>
>
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to