我有以下代码: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["55a930cd27daeaa6108b4f68", "55a930cd27daeaa6108b4f67"]
是否有一个特殊的标志传递给函数?在docs他们正在谈论数组作为返回值。我错过了什么?
的jQuery 1.11.2
http://api.jquery.com/map/和http://api.jquery.com/jquery.map/有什么区别? ?我有点困惑。 – Tamara
一个在jQuery对象(通常是元素)上工作,另一个在普通对象或数组上。 – Scimonster