Skip to content

Commit 57b550d

Browse files
committed
chunk array 📚
1 parent aee8b70 commit 57b550d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

chunk_array.js

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

0 commit comments

Comments
 (0)