Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法让 jQuery 切片返回元素数组而不是 jQuery 对象?也许来自 jQuery 兼容库的替代函数?
还是我必须自己使用makeArray(或自己做)转换成一个数组?
(我问是因为一旦我发现each2,我总是想象有一个针对给定任务的稍微优化的函数)。
用于.get()从 jQuery 对象返回“正常”数组。
.get()
例子:
var arr = $('div').slice(2, 4).get();