我希望这次在数组中重复对象的值31次。
有没有办法用$ .each语句,或只是常规的js for循环?
感谢
dayz = 31;
var numberArray = [{obj:1}, {obj:2}, {obj:3}, {obj:4}, {obj:5}];
jQuery.each(numberArray , function(index, value){
console.log(numberArray[index%dayz]);
});
答案 0 :(得分:0)
dayz = 31;
var numberArray = [{obj:1}, {obj:2}, {obj:3}, {obj:4}, {obj:5}];
jQuery.each(new Array(dayz), function(i){
jQuery.each(numberArray, function(idx, val){
console.log(numberArray[idx%dayz]);
})
});