---
title: "Discussion on \"Learning to chunk an array with JavaScript\" | Hashnode"
description: "Discussion on \"Learning to chunk an array with JavaScript\". Instructions\nGiven the array and chunk size, divide the array into multiple subarrays where each is of similar length\n//EXAMPLES\nchunk([1, 2, 3, 4], 2) --> [[ 1, 2], [3, 4]]\nchunk([1, 2, 3, 4, 5], 2) --> [[ 1, 2], [3, 4], [5]]\nchunk([1, 2, 3, 4, 5, 6..."
url: "https://hashnode.com/posts/learning-to-chunk-an-array-with-javascript/6151ecd6040ee872369502fa"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Learning to chunk an array with JavaScript](https://delvoid.hashnode.dev/learning-to-chunk-an-array-with-javascript?utm_source=hashnode&utm_medium=feed)

Instructions Given the array and chunk size, divide the array into multiple subarrays where each is of similar length //EXAMPLES chunk(\[1, 2, 3, 4\], 2) --> \[\[ 1, 2\], \[3, 4\]\] chunk(\[1, 2, 3, 4, 5\], 2) --> \[\[ 1, 2\], \[3, 4\], \[5\]\] chunk(\[1, 2, 3, 4, 5, 6...

Sep 27, 2021 · 2 min read · delvoid.hashnode.dev  
Updated Oct 11, 2021  
Read the article

-   [#learning](https://hashnode.com/tag/learning)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#algorithms](https://hashnode.com/tag/algorithms)
-   [#learning-journey](https://hashnode.com/tag/learning-journey)

## Written by

[Dave Hough](https://hashnode.com/@Delvoid)

@Delvoid · United Kingdom

  
[View profile](https://hashnode.com/@Delvoid)

Developer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
