jQuery map()返回对象而不是数组

jQuery map()返回对象而不是数组,jquery,Jquery,我有以下代码: var selectedTitles = $("#js-otms-titles-table .select_title :checkbox:checked").map(function() { return $(this).attr('data-titleId'); }); console.log("Selected titles"); console.log(selectedTitles); 我希望结果将是一个数组。但是,我收到的对象如下: Object["55a93

我有以下代码:

var selectedTitles = $("#js-otms-titles-table .select_title :checkbox:checked").map(function() {
    return $(this).attr('data-titleId');
});
console.log("Selected titles");
console.log(selectedTitles);
我希望结果将是一个数组。但是,我收到的对象如下:

Object["55a930cd27daeaa6108b4f68", "55a930cd27daeaa6108b4f67"]
是否有要传递给函数的特殊标志?在本文中,他们将数组作为返回值进行讨论。我错过什么了吗


jQuery 1.11.2

您需要对最终结果调用
.get()
。jQuery的
.map()
函数返回一个jQuery对象(有时很方便)
.get()
将获取构建它的基础数组

请参见

$(选择器)。map()始终返回jQuery对象

要从jQuery对象获取数组,请使用
get()

$.map(a,f)
-数组输入-数组输出

$(选择器).map(f)
-jQuery对象输入-jQuery对象输出

$(选择器).map(f).get()
-jQuery对象输入-数组输出(从jQuery 1.0开始)


$(选择器).map(f).toArray()
-jQuery对象输入-数组输出(自jQuery 1.4以来)

和之间的区别是什么?我有点困惑,一个用于jQuery对象(通常是元素),另一个用于普通对象或数组。
var selectedTitles = $("#js-otms-titles-table .select_title :checkbox:checked").map(function() {
    return $(this).attr('data-titleId');
}).get();
var a = array(1, 2, 3);
var f = function () { return do_something_with_each(this); };