What function acts as .SelectMany() in jQuery?

map will flatten native arrays. Therefore, you can write:

$("tr").map(function() { return $(this).children().get(); })

You need to call .get() to return a native array rather than a jQuery object.

This will work on regular objects as well.

var nested = [ [1], [2], [3] ];
var flattened = $(nested).map(function() { return this; });

flattened will equal [1, 2, 3].

Leave a Comment

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