Why would the following jquery code sometimes throw the error "concat is not a function":
var myArray = $('div.foo')
    .filter(function() { return $(this).is('.something'); })
    .map(function() { 
        return [['a', 'b', $(this).val()]];
    });
return myArray.concat(anotherArray);
                $().map() returns a jQuery object, not an array.
jQuery objects do not have a concat() method.
You need to call .get() to get a real array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With