How to use jQuery.map() on array of objects to return array of arrays

With the jQuery.map()(docs) and map()(docs) methods you need to double wrap the return value:

var ArrArr = $.map(ObjArr, function(n,i){
   return [[ n.a, n.b ]];
});

…otherwise for some reason it concats the Array being returned. This way it concats the outer Array, and placing the content (the inner Array) at the next index.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)