chunk
_.chunk(array, length)
将 array 分成多个数组,每个数组包含 length 或更少的项。
var partners = _.chunk(_.shuffle(kindergarten), 2);
=> [["Tyrone", "Elie"], ["Aidan", "Sam"], ["Katrina", "Billie"], ["Little Timmy"]]
_.chunk(array, length)
将 array 分成多个数组,每个数组包含 length 或更少的项。
var partners = _.chunk(_.shuffle(kindergarten), 2);
=> [["Tyrone", "Elie"], ["Aidan", "Sam"], ["Katrina", "Billie"], ["Little Timmy"]]