Skip to content

Commit c231307

Browse files
committed
chunk array solution
1 parent be22426 commit c231307

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

easy/chunk-array.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const chunk = (arr, size) => {
2+
let result = [];
3+
for (let i = 0; i < arr.length; i += size) {
4+
result.push(arr.slice(i, i + size));
5+
}
6+
return result;
7+
};

0 commit comments

Comments
 (0)