更新时间:2021-09-01 23:23:44
不要使用 jquery...使用普通的 javascript
Don't use jquery...use plain javascript
var a = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
var b = a.splice(0,10);
//a is now [11,12,13,14,15];
//b is now [1,2,3,4,5,6,7,8,9,10];
你可以循环这个以获得你想要的行为.
You could loop this to get the behavior you want.
var a = YOUR_ARRAY;
while(a.length) {
console.log(a.splice(0,10));
}
这一次会给你 10 个元素……如果你说 15 个元素,你会得到 1-10,你想要的 11-15.
This would give you 10 elements at a time...if you have say 15 elements, you would get 1-10, the 11-15 as you wanted.