Why is there array.filter and array.map if they do the same?

On Jan 3, 7:48 am, Ryan Florence <[email protected]> wrote:
> It's odd, I use .map with ruby constantly, and have never used it in  
> mootools ...
>
> On Jan 2, 2010, at 10:36 PM, Aaron Newton wrote:
>
>
>
> > Doh!!!
>
> > -Aaron
>
> > Sorry for any typos. Big fingers , tiny buttons.
>
> > On Jan 2, 2010, at 7:03 PM, Perrin Perrin  
> > <[email protected]> wrote:
>
> >> see array.maphttp://www.mootools.net/docs/core/Native/
> >> Array#Array:map
>
> >> Same function that Aron put up but with map instead of filter.
>
> >> On Sat, Jan 2, 2010 at 8:54 PM, Aaron Newton <[email protected]>  
> >> wrote:
> >> see array.filter
>
> >> myLinks.filter(function(link){ return link.get('href'); });
>
> >> On Sat, Jan 2, 2010 at 6:50 PM, mmjaeger <[email protected]> wrote:
> >> stupid me - sorry - I need to get the hrefs into an array and then
> >> encode it - thanks for replying
>
> >> On Jan 2, 6:44 pm, Aaron Newton <[email protected]> wrote:
> >> > DOM elements are not JSON encodable (what would you expect it to  
> >> do with
> >> > them?).
>
> >> > On Sat, Jan 2, 2010 at 6:31 PM, mmjaeger <[email protected]>  
> >> wrote:
> >> > > Hello
> >> > > I've the following code:
> >> > > var arr = document.id(document.body).getElements('a[href$=mp3]');
> >> > > console.log(arr.length); // RETURNS 6
> >> > > console.log('JSON: ' + JSON.encode(arr)); // RETURNS JUST []
>
> >> > > what am I missing?
>
> >> > > Thank you

Reply via email to