In the following example:
HTML:
<ul>
<li id="0"></li>
<li id="213"></li>
<li id="324"></li>
<li id="764"></li>
</ul>
JS:
var map = $("ul").children().map(function(i, el) {
return el.id;
});
console.log(Array.prototype.slice.call(map).join(":")); // 0:213:324:764
console.log(map.join(":")); //error: Uncaught TypeError: undefined is not a function
The map function will error if trying to use native array methods,
if you parse the returned jq 'array' into a normal array - everything works.
What could be the reason to it?
Fiddle: http://jsfiddle.net/hQZqU/1/
joinmethod. Call.get()first to convert the an array from the jquery object.map.get().join(":")@FelixKling comments pretty much sums up thing.lengthproperty is an array-like object. And thinking about it, since a jquery object usually contains DOM elements, what should happen when you concatenate them with a string?