JavaScript 1.6 Array.map() and Array.filter() not working with built in functions as arguments

Posted by bucabay on Stack Overflow See other posts from Stack Overflow or by bucabay
Published on 2010-04-15T18:01:56Z Indexed on 2010/04/15 18:03 UTC
Read the original article Hit count: 159

Filed under:
|

This works fine:

["655971", "2343", "343"].map(function(x) { return parseInt(x) }) // [655971, 2343, 343]

But this doesnt:

["655971", "2343", "343"].map(parseInt) // [655971, NaN, NaN]

The same happens for Array.filter()

What am I missing here?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about array