Can't do push in forEach

Allen Wirfs-Brock allen at wirfs-brock.com
Thu May 14 15:37:34 UTC 2015


On May 14, 2015, at 8:19 AM, Emanuel Allen wrote:

> Oh yes that is correct since push will push in elements separated by commas... Still my original problem is that I can't simply do arr.push(arr2.push); but it doesn't matter since it'll also push the three parameters into the array as well. 

exactly, see http://www.wirfs-brock.com/allen/posts/166 

> 
> 
> Sent from my iPhone
> 
> On May 14, 2015, at 10:49 AM, Erik Arvidsson <erik.arvidsson at gmail.com> wrote:
> 
>> Still, the callback for forEach is called with 3 arguments; value, index and the array.
>> 
>> This is clearly documented in the spec and mdn and other resources.
>> 
>> 
>> On Thu, May 14, 2015, 10:42 Garrett Smith <dhtmlkitchen at gmail.com> wrote:
>> On 5/14/15, Emanuel Allen <emanuelallen at hotmail.com> wrote:
>> > Surprise that I can't do arr1.forEeach(arr2.push);
>> >
>> 
>> Check that line more carefully.
>> 
>> 
>> > Will throw an error.
>> >
>> > Using bind as:
>> >
>> > push = arr2.bind(push);
>> 
>> Arrays don't have a bind method.
>> --
>> Garrett
>> @xkit
>> ChordCycles.com
>> garretts.github.io
>> personx.tumblr.com
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
> _______________________________________________
> 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/20150514/29565c15/attachment.html>


More information about the es-discuss mailing list