Example 1 — Convert a Selection to an Array
Get a native Array of matched elements and inspect length / tags.
var items = $("li").toArray();
console.log(items.length); // 3
console.log(Array.isArray(items)); // true
console.log(items[0].tagName); // LI How It Works
- Select.
$("li")builds a jQuery set of list items. - Convert.
.toArray()returns a realArray. - Inspect. Length is 3; first node’s
tagNameisLI.

