js给Array数组增加chunk方法.
Array.prototype.chunk = function(n){
for(var i = 0, temp = [], l = ~~this.length / n; temp.length < l; temp[i++] = this.splice(0, n));
return temp;
}
var array = '173IT技术网很棒,中国人民很行'.split('')
// to use
array .chunk(2)
array .chunk(3)
更多信息请查看IT技术专栏