I have a form that I get with $('#formId')
using jquery. This gives me an array of inputs elements in which I would like to use Array.prototype.reduce
but apparently I can't. Why is that? Isn't the array returned by the jquery selector a "normal" array? And why I can use other Array.prototype
methods like map
, or filter
and not reduce
. Can anyone explain me the logic here?
Asked
Active
Viewed 36 times
1

António Quadrado
- 1,307
- 2
- 17
- 34
-
1Duplicate tl;dr: it's not an array. jQuery [map](http://api.jquery.com/map/) and [filter](http://api.jquery.com/filter/) methods are not Array.prototype methods. – JJJ Jan 30 '17 at 13:17
-
1can use `get()` to return a real array – charlietfl Jan 30 '17 at 13:22
-
I though that the jquery returned a normal array. didn't know about the 'wrapped set'. Thanks for pointing me to answer that explains it. Couldn't find it before. – António Quadrado Jan 30 '17 at 13:22